apps/apps.c:1437: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_INTEGER_new()` at line 1403, column 10 is not reachable after line 1437, column 5.
Showing all 71 steps of the trace


apps/apps.c:1396:1: start of procedure load_serial()
1394.   #undef BSIZE
1395.   #define BSIZE 256
1396. > BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai)
1397.   {
1398.       BIO *in = NULL;

apps/apps.c:1398:5: 
1396.   BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai)
1397.   {
1398. >     BIO *in = NULL;
1399.       BIGNUM *ret = NULL;
1400.       char buf[1024];

apps/apps.c:1399:5: 
1397.   {
1398.       BIO *in = NULL;
1399. >     BIGNUM *ret = NULL;
1400.       char buf[1024];
1401.       ASN1_INTEGER *ai = NULL;

apps/apps.c:1401:5: 
1399.       BIGNUM *ret = NULL;
1400.       char buf[1024];
1401. >     ASN1_INTEGER *ai = NULL;
1402.   
1403.       ai = ASN1_INTEGER_new();

apps/apps.c:1403:5: 
1401.       ASN1_INTEGER *ai = NULL;
1402.   
1403. >     ai = ASN1_INTEGER_new();
1404.       if (ai == NULL)
1405.           goto err;

crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_INTEGER_new()
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

crypto/asn1/asn1_lib.c:348:1: start of procedure ASN1_STRING_type_new()
    346.   }
    347.   
    348. > ASN1_STRING *ASN1_STRING_type_new(int type)
    349.   {
    350.       ASN1_STRING *ret;

crypto/asn1/asn1_lib.c:352:5: 
    350.       ASN1_STRING *ret;
    351.   
    352. >     ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
      154.   }
      155.   
      156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158. >     void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
        117.   }
        118.   
        119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
        120.   {
        121.       void *ret = NULL;

crypto/mem.c:121:5: 
        119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
        120.   {
        121. >     void *ret = NULL;
        122.   
        123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
        121.       void *ret = NULL;
        122.   
        123.       if (num <= 0)
                       ^
        124.           return NULL;
        125.   

crypto/mem.c:126:5: 
        124.           return NULL;
        125.   
        126. >     allow_customize = 0;
        127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
        128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
        134.       }
        135.   #else
        136. >     (void)file;
        137.       (void)line;
        138.       ret = malloc(num);

crypto/mem.c:137:5: 
        135.   #else
        136.       (void)file;
        137. >     (void)line;
        138.       ret = malloc(num);
        139.   #endif

crypto/mem.c:138:5: 
        136.       (void)file;
        137.       (void)line;
        138. >     ret = malloc(num);
        139.   #endif
        140.   

crypto/mem.c:153:5: 
        151.   #endif
        152.   
        153. >     return ret;
        154.   }
        155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
        152.   
        153.       return ret;
        154. > }
        155.   
        156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
      158.       void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       if (ret != NULL)
                     ^
      161.           memset(ret, 0, num);
      162.       return ret;

crypto/mem.c:161:9: 
      159.   
      160.       if (ret != NULL)
      161. >         memset(ret, 0, num);
      162.       return ret;
      163.   }

crypto/mem.c:162:5: 
      160.       if (ret != NULL)
      161.           memset(ret, 0, num);
      162. >     return ret;
      163.   }
      164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
      161.           memset(ret, 0, num);
      162.       return ret;
      163. > }
      164.   
      165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/asn1_lib.c:353:9: Taking false branch
    351.   
    352.       ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
                   ^
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    355.           return (NULL);

crypto/asn1/asn1_lib.c:357:5: 
    355.           return (NULL);
    356.       }
    357. >     ret->type = type;
    358.       return (ret);
    359.   }

crypto/asn1/asn1_lib.c:358:5: 
    356.       }
    357.       ret->type = type;
    358. >     return (ret);
    359.   }
    360.   

crypto/asn1/asn1_lib.c:359:1: return from a call to ASN1_STRING_type_new
    357.       ret->type = type;
    358.       return (ret);
    359. > }
    360.   
    361.   void ASN1_STRING_free(ASN1_STRING *a)

crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_INTEGER_new
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

apps/apps.c:1404:9: Taking false branch
1402.   
1403.       ai = ASN1_INTEGER_new();
1404.       if (ai == NULL)
                ^
1405.           goto err;
1406.   

apps/apps.c:1407:5: Skipping BIO_new_file(): empty list of specs
1405.           goto err;
1406.   
1407.       in = BIO_new_file(serialfile, "r");
            ^
1408.       if (in == NULL) {
1409.           if (!create) {

apps/apps.c:1408:9: Taking false branch
1406.   
1407.       in = BIO_new_file(serialfile, "r");
1408.       if (in == NULL) {
                ^
1409.           if (!create) {
1410.               perror(serialfile);

apps/apps.c:1418:14: Taking true branch
1416.               BIO_printf(bio_err, "Out of memory\n");
1417.       } else {
1418.           if (!a2i_ASN1_INTEGER(in, ai, buf, 1024)) {
                     ^
1419.               BIO_printf(bio_err, "unable to load number from %s\n",
1420.                          serialfile);

apps/apps.c:1419:13: Skipping BIO_printf(): empty list of specs
1417.       } else {
1418.           if (!a2i_ASN1_INTEGER(in, ai, buf, 1024)) {
1419.               BIO_printf(bio_err, "unable to load number from %s\n",
                    ^
1420.                          serialfile);
1421.               goto err;

apps/apps.c:1435:2: 
1433.           ai = NULL;
1434.       }
1435. >  err:
1436.       BIO_free(in);
1437.       ASN1_INTEGER_free(ai);

apps/apps.c:1436:5: 
1434.       }
1435.    err:
1436. >     BIO_free(in);
1437.       ASN1_INTEGER_free(ai);
1438.       return (ret);

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

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

crypto/bio/bio_lib.c:112:5: 
  110.           return (0);
  111.   
  112. >     i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_BIO);
  113.   #ifdef REF_PRINT
  114.       REF_PRINT("BIO", a);

crypto/lock.c:455:1: start of procedure CRYPTO_add_lock()
    453.   }
    454.   
    455. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
    456.                       int line)
    457.   {

crypto/lock.c:458:5: 
    456.                       int line)
    457.   {
    458. >     int ret = 0;
    459.   
    460.       if (add_lock_callback != NULL) {

crypto/lock.c:460:9: Taking false branch
    458.       int ret = 0;
    459.   
    460.       if (add_lock_callback != NULL) {
                   ^
    461.   #ifdef LOCK_DEBUG
    462.           int before = *pointer;

crypto/lock.c:476:9: 
    474.   #endif
    475.       } else {
    476. >         CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
    477.   
    478.           ret = *pointer + amount;

crypto/lock.c:413:1: start of procedure CRYPTO_lock()
      411.   }
      412.   
      413. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      414.   {
      415.   #ifdef LOCK_DEBUG

crypto/lock.c:440:9: Taking false branch
      438.       }
      439.   #endif
      440.       if (type < 0) {
                     ^
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:451:16: Taking false branch
      449.               CRYPTO_destroy_dynlockid(type);
      450.           }
      451.       } else if (locking_callback != NULL)
                            ^
      452.           locking_callback(mode, type, file, line);
      453.   }

crypto/lock.c:440:5: 
      438.       }
      439.   #endif
      440. >     if (type < 0) {
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

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

crypto/lock.c:478:9: 
    476.           CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
    477.   
    478. >         ret = *pointer + amount;
    479.   #ifdef LOCK_DEBUG
    480.           {

crypto/lock.c:489:9: 
    487.           }
    488.   #endif
    489. >         *pointer = ret;
    490.           CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
    491.       }

crypto/lock.c:490:9: 
    488.   #endif
    489.           *pointer = ret;
    490. >         CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
    491.       }
    492.       return (ret);

crypto/lock.c:413:1: start of procedure CRYPTO_lock()
      411.   }
      412.   
      413. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      414.   {
      415.   #ifdef LOCK_DEBUG

crypto/lock.c:440:9: Taking false branch
      438.       }
      439.   #endif
      440.       if (type < 0) {
                     ^
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:451:16: Taking false branch
      449.               CRYPTO_destroy_dynlockid(type);
      450.           }
      451.       } else if (locking_callback != NULL)
                            ^
      452.           locking_callback(mode, type, file, line);
      453.   }

crypto/lock.c:440:5: 
      438.       }
      439.   #endif
      440. >     if (type < 0) {
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

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

crypto/lock.c:492:5: 
    490.           CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
    491.       }
    492. >     return (ret);
    493.   }
    494.   

crypto/lock.c:493:1: return from a call to CRYPTO_add_lock
    491.       }
    492.       return (ret);
    493. > }
    494.   
    495.   const char *CRYPTO_get_lock_name(int type)

crypto/bio/bio_lib.c:116:9: Taking false branch
  114.       REF_PRINT("BIO", a);
  115.   #endif
  116.       if (i > 0)
                 ^
  117.           return (1);
  118.   #ifdef REF_CHECK

crypto/bio/bio_lib.c:124:10: Taking true branch
  122.       }
  123.   #endif
  124.       if ((a->callback != NULL) &&
                  ^
  125.           ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
  126.           return (i);

crypto/bio/bio_lib.c:125:10: Taking true branch
  123.   #endif
  124.       if ((a->callback != NULL) &&
  125.           ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
                  ^
  126.           return (i);
  127.   

crypto/bio/bio_lib.c:126:9: 
  124.       if ((a->callback != NULL) &&
  125.           ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
  126. >         return (i);
  127.   
  128.       CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);

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

apps/apps.c:1437:5: 
1435.    err:
1436.       BIO_free(in);
1437. >     ASN1_INTEGER_free(ai);
1438.       return (ret);
1439.   }

crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_INTEGER_free()
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

crypto/asn1/asn1_lib.c:361:1: start of procedure ASN1_STRING_free()
    359.   }
    360.   
    361. > void ASN1_STRING_free(ASN1_STRING *a)
    362.   {
    363.       if (a == NULL)

crypto/asn1/asn1_lib.c:363:9: Taking false branch
    361.   void ASN1_STRING_free(ASN1_STRING *a)
    362.   {
    363.       if (a == NULL)
                   ^
    364.           return;
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))

crypto/asn1/asn1_lib.c:365:11: Taking false branch
    363.       if (a == NULL)
    364.           return;
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
                     ^
    366.           OPENSSL_free(a->data);
    367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))

crypto/asn1/asn1_lib.c:367:11: Taking false branch
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
    366.           OPENSSL_free(a->data);
    367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
                     ^
    368.           OPENSSL_free(a);
    369.   }

crypto/asn1/asn1_lib.c:367:5: 
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
    366.           OPENSSL_free(a->data);
    367. >     if (!(a->flags & ASN1_STRING_FLAG_EMBED))
    368.           OPENSSL_free(a);
    369.   }

crypto/asn1/asn1_lib.c:369:1: return from a call to ASN1_STRING_free
    367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
    368.           OPENSSL_free(a);
    369. > }
    370.   
    371.   void ASN1_STRING_clear_free(ASN1_STRING *a)

crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_INTEGER_free
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
