apps/gendsa.c:189: error: NULL_DEREFERENCE
  pointer `dsa` last assigned on line 97 could be null and is dereferenced by call to `DSA_free()` at line 189, column 5.
Showing all 41 steps of the trace


apps/gendsa.c:94:1: start of procedure gendsa_main()
92.   };
93.   
94. > int gendsa_main(int argc, char **argv)
95.   {
96.       BIO *out = NULL, *in = NULL;

apps/gendsa.c:96:5: 
94.   int gendsa_main(int argc, char **argv)
95.   {
96. >     BIO *out = NULL, *in = NULL;
97.       DSA *dsa = NULL;
98.       const EVP_CIPHER *enc = NULL;

apps/gendsa.c:97:5: 
95.   {
96.       BIO *out = NULL, *in = NULL;
97. >     DSA *dsa = NULL;
98.       const EVP_CIPHER *enc = NULL;
99.       char *inrand = NULL, *dsaparams = NULL;

apps/gendsa.c:98:5: 
96.       BIO *out = NULL, *in = NULL;
97.       DSA *dsa = NULL;
98. >     const EVP_CIPHER *enc = NULL;
99.       char *inrand = NULL, *dsaparams = NULL;
100.       char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;

apps/gendsa.c:99:5: 
97.       DSA *dsa = NULL;
98.       const EVP_CIPHER *enc = NULL;
99. >     char *inrand = NULL, *dsaparams = NULL;
100.       char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
101.       OPTION_CHOICE o;

apps/gendsa.c:100:5: 
98.       const EVP_CIPHER *enc = NULL;
99.       char *inrand = NULL, *dsaparams = NULL;
100. >     char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
101.       OPTION_CHOICE o;
102.       int ret = 1, private = 0;

apps/gendsa.c:102:5: 
100.       char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
101.       OPTION_CHOICE o;
102. >     int ret = 1, private = 0;
103.   
104.       prog = opt_init(argc, argv, gendsa_options);

apps/gendsa.c:104:5: Skipping opt_init(): empty list of specs
102.       int ret = 1, private = 0;
103.   
104.       prog = opt_init(argc, argv, gendsa_options);
           ^
105.       while ((o = opt_next()) != OPT_EOF) {
106.           switch (o) {

apps/gendsa.c:105:12: Loop condition is true. Entering loop body
103.   
104.       prog = opt_init(argc, argv, gendsa_options);
105.       while ((o = opt_next()) != OPT_EOF) {
                  ^
106.           switch (o) {
107.           case OPT_EOF:

apps/gendsa.c:106:9: 
104.       prog = opt_init(argc, argv, gendsa_options);
105.       while ((o = opt_next()) != OPT_EOF) {
106. >         switch (o) {
107.           case OPT_EOF:
108.           case OPT_ERR:

apps/gendsa.c:107:9: Switch condition is false. Skipping switch case
105.       while ((o = opt_next()) != OPT_EOF) {
106.           switch (o) {
107.           case OPT_EOF:
               ^
108.           case OPT_ERR:
109.    opthelp:

apps/gendsa.c:108:9: Switch condition is false. Skipping switch case
106.           switch (o) {
107.           case OPT_EOF:
108.           case OPT_ERR:
               ^
109.    opthelp:
110.               BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);

apps/gendsa.c:112:9: Switch condition is true. Entering switch case
110.               BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
111.               goto end;
112.           case OPT_HELP:
               ^
113.               ret = 0;
114.               opt_help(gendsa_options);

apps/gendsa.c:113:13: 
111.               goto end;
112.           case OPT_HELP:
113. >             ret = 0;
114.               opt_help(gendsa_options);
115.               goto end;

apps/gendsa.c:114:13: Skipping opt_help(): empty list of specs
112.           case OPT_HELP:
113.               ret = 0;
114.               opt_help(gendsa_options);
                   ^
115.               goto end;
116.           case OPT_OUT:

apps/gendsa.c:183:2: 
181.           goto end;
182.       ret = 0;
183. >  end:
184.       if (ret != 0)
185.           ERR_print_errors(bio_err);

apps/gendsa.c:184:9: Taking false branch
182.       ret = 0;
183.    end:
184.       if (ret != 0)
               ^
185.           ERR_print_errors(bio_err);
186.    end2:

apps/gendsa.c:186:2: 
184.       if (ret != 0)
185.           ERR_print_errors(bio_err);
186. >  end2:
187.       BIO_free(in);
188.       BIO_free_all(out);

apps/gendsa.c:187:5: 
185.           ERR_print_errors(bio_err);
186.    end2:
187. >     BIO_free(in);
188.       BIO_free_all(out);
189.       DSA_free(dsa);

crypto/bio/bio_lib.c:106:1: start of procedure BIO_free()
  104.   }
  105.   
  106. > int BIO_free(BIO *a)
  107.   {
  108.       int i;

crypto/bio/bio_lib.c:110:9: Taking true branch
  108.       int i;
  109.   
  110.       if (a == NULL)
                 ^
  111.           return (0);
  112.   

crypto/bio/bio_lib.c:111:9: 
  109.   
  110.       if (a == NULL)
  111. >         return (0);
  112.   
  113.       i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_BIO);

crypto/bio/bio_lib.c:135:1: return from a call to BIO_free
  133.       OPENSSL_free(a);
  134.       return (1);
  135. > }
  136.   
  137.   void BIO_vfree(BIO *a)

apps/gendsa.c:188:5: 
186.    end2:
187.       BIO_free(in);
188. >     BIO_free_all(out);
189.       DSA_free(dsa);
190.       OPENSSL_free(passout);

crypto/bio/bio_lib.c:499:1: start of procedure BIO_free_all()
  497.   }
  498.   
  499. > void BIO_free_all(BIO *bio)
  500.   {
  501.       BIO *b;

crypto/bio/bio_lib.c:504:12: Loop condition is false. Leaving loop
  502.       int ref;
  503.   
  504.       while (bio != NULL) {
                    ^
  505.           b = bio;
  506.           ref = b->references;

crypto/bio/bio_lib.c:513:1: return from a call to BIO_free_all
  511.               break;
  512.       }
  513. > }
  514.   
  515.   BIO *BIO_dup_chain(BIO *in)

apps/gendsa.c:189:5: 
187.       BIO_free(in);
188.       BIO_free_all(out);
189. >     DSA_free(dsa);
190.       OPENSSL_free(passout);
191.       return (ret);

crypto/dsa/dsa_lib.c:174:1: start of procedure DSA_free()
  172.   }
  173.   
  174. > void DSA_free(DSA *r)
  175.   {
  176.       int i;

crypto/dsa/dsa_lib.c:178:9: Taking false branch
  176.       int i;
  177.   
  178.       if (r == NULL)
                 ^
  179.           return;
  180.   

crypto/dsa/dsa_lib.c:181:5: 
  179.           return;
  180.   
  181. >     i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DSA);
  182.   #ifdef REF_PRINT
  183.       REF_PRINT("DSA", r);

crypto/lock.c:459:1: start of procedure CRYPTO_add_lock()
    457.   }
    458.   
    459. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
    460.                       int line)
    461.   {

crypto/lock.c:462:5: 
    460.                       int line)
    461.   {
    462. >     int ret = 0;
    463.   
    464.       if (add_lock_callback != NULL) {

crypto/lock.c:464:9: Taking false branch
    462.       int ret = 0;
    463.   
    464.       if (add_lock_callback != NULL) {
                   ^
    465.   #ifdef LOCK_DEBUG
    466.           int before = *pointer;

crypto/lock.c:480:9: 
    478.   #endif
    479.       } else {
    480. >         CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
    481.   
    482.           ret = *pointer + amount;

crypto/lock.c:417:1: start of procedure CRYPTO_lock()
      415.   }
      416.   
      417. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      418.   {
      419.   #ifdef LOCK_DEBUG

crypto/lock.c:444:9: Taking false branch
      442.       }
      443.   #endif
      444.       if (type < 0) {
                     ^
      445.           if (dynlock_lock_callback != NULL) {
      446.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:455:16: Taking false branch
      453.               CRYPTO_destroy_dynlockid(type);
      454.           }
      455.       } else if (locking_callback != NULL)
                            ^
      456.           locking_callback(mode, type, file, line);
      457.   }

crypto/lock.c:444:5: 
      442.       }
      443.   #endif
      444. >     if (type < 0) {
      445.           if (dynlock_lock_callback != NULL) {
      446.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:457:1: return from a call to CRYPTO_lock
      455.       } else if (locking_callback != NULL)
      456.           locking_callback(mode, type, file, line);
      457. > }
      458.   
      459.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/lock.c:482:9: 
    480.           CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
    481.   
    482. >         ret = *pointer + amount;
    483.   #ifdef LOCK_DEBUG
    484.           {
