crypto/x509/x509_lu.c:354: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 335, column 11 is not reachable after line 354, column 9.
Showing all 61 steps of the trace


crypto/x509/x509_lu.c:328:1: start of procedure X509_STORE_add_cert()
326.   }
327.   
328. > int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
329.   {
330.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:331:5: 
329.   {
330.       X509_OBJECT *obj;
331. >     int ret = 1;
332.   
333.       if (x == NULL)

crypto/x509/x509_lu.c:333:9: Taking false branch
331.       int ret = 1;
332.   
333.       if (x == NULL)
               ^
334.           return 0;
335.       obj = OPENSSL_malloc(sizeof(*obj));

crypto/x509/x509_lu.c:335:5: 
333.       if (x == NULL)
334.           return 0;
335. >     obj = OPENSSL_malloc(sizeof(*obj));
336.       if (obj == NULL) {
337.           X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);

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

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

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

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

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

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

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

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

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

crypto/x509/x509_lu.c:336:9: Taking false branch
334.           return 0;
335.       obj = OPENSSL_malloc(sizeof(*obj));
336.       if (obj == NULL) {
               ^
337.           X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
338.           return 0;

crypto/x509/x509_lu.c:340:5: 
338.           return 0;
339.       }
340. >     obj->type = X509_LU_X509;
341.       obj->data.x509 = x;
342.   

crypto/x509/x509_lu.c:341:5: 
339.       }
340.       obj->type = X509_LU_X509;
341. >     obj->data.x509 = x;
342.   
343.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);

crypto/x509/x509_lu.c:343:5: 
341.       obj->data.x509 = x;
342.   
343. >     CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
344.   
345.       X509_OBJECT_up_ref_count(obj);

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

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

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

crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
  451.           }
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
                 ^
  454.   }
  455.   

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

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

crypto/x509/x509_lu.c:345:5: 
343.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
344.   
345. >     X509_OBJECT_up_ref_count(obj);
346.   
347.       if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {

crypto/x509/x509_lu.c:393:1: start of procedure X509_OBJECT_up_ref_count()
  391.   }
  392.   
  393. > void X509_OBJECT_up_ref_count(X509_OBJECT *a)
  394.   {
  395.       switch (a->type) {

crypto/x509/x509_lu.c:395:5: 
  393.   void X509_OBJECT_up_ref_count(X509_OBJECT *a)
  394.   {
  395. >     switch (a->type) {
  396.       default:
  397.           break;

crypto/x509/x509_lu.c:398:5: Switch condition is true. Entering switch case
  396.       default:
  397.           break;
  398.       case X509_LU_X509:
             ^
  399.           X509_up_ref(a->data.x509);
  400.           break;

crypto/x509/x509_lu.c:399:9: 
  397.           break;
  398.       case X509_LU_X509:
  399. >         X509_up_ref(a->data.x509);
  400.           break;
  401.       case X509_LU_CRL:

crypto/x509/x509_set.c:150:1: start of procedure X509_up_ref()
    148.   }
    149.   
    150. > void X509_up_ref(X509 *x)
    151.   {
    152.       CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);

crypto/x509/x509_set.c:152:5: 
    150.   void X509_up_ref(X509 *x)
    151.   {
    152. >     CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
    153.   }
    154.   

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

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

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

crypto/lock.c:466:9: Skipping __function_pointer__(): unresolved function pointer
      464.   #endif
      465.   
      466.           ret = add_lock_callback(pointer, amount, type, file, line);
                     ^
      467.   #ifdef LOCK_DEBUG
      468.           {

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

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

crypto/x509/x509_set.c:153:1: return from a call to X509_up_ref
    151.   {
    152.       CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
    153. > }
    154.   
    155.   long X509_get_version(X509 *x)

crypto/x509/x509_lu.c:405:1: return from a call to X509_OBJECT_up_ref_count
  403.           break;
  404.       }
  405. > }
  406.   
  407.   void X509_OBJECT_free_contents(X509_OBJECT *a)

crypto/x509/x509_lu.c:347:9: Taking false branch
345.       X509_OBJECT_up_ref_count(obj);
346.   
347.       if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
               ^
348.           X509_OBJECT_free_contents(obj);
349.           OPENSSL_free(obj);

crypto/x509/x509_lu.c:354:9: 
352.           ret = 0;
353.       } else
354. >         sk_X509_OBJECT_push(ctx->objs, obj);
355.   
356.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

include/openssl/x509_vfy.h:124:1: start of procedure sk_X509_OBJECT_push()
  122.   
  123.   DEFINE_STACK_OF(X509_LOOKUP)
  124. > DEFINE_STACK_OF(X509_OBJECT)
  125.   
  126.   /* This is a static that defines the function interface */

crypto/stack/stack.c:259:1: start of procedure sk_push()
    257.   }
    258.   
    259. > int sk_push(_STACK *st, void *data)
    260.   {
    261.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:261:5: 
    259.   int sk_push(_STACK *st, void *data)
    260.   {
    261. >     return (sk_insert(st, data, st->num));
    262.   }
    263.   

crypto/stack/stack.c:167:1: start of procedure sk_insert()
      165.   }
      166.   
      167. > int sk_insert(_STACK *st, void *data, int loc)
      168.   {
      169.       char **s;

crypto/stack/stack.c:171:9: Taking false branch
      169.       char **s;
      170.   
      171.       if (st == NULL)
                     ^
      172.           return 0;
      173.       if (st->num_alloc <= st->num + 1) {

crypto/stack/stack.c:173:9: Taking true branch
      171.       if (st == NULL)
      172.           return 0;
      173.       if (st->num_alloc <= st->num + 1) {
                     ^
      174.           s = OPENSSL_realloc((char *)st->data,
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);

crypto/stack/stack.c:174:9: 
      172.           return 0;
      173.       if (st->num_alloc <= st->num + 1) {
      174. >         s = OPENSSL_realloc((char *)st->data,
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      176.           if (s == NULL)

crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
        164.   }
        165.   
        166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
        167.   {
        168.       if (str == NULL)

crypto/mem.c:168:9: Taking true branch
        166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
        167.   {
        168.       if (str == NULL)
                       ^
        169.           return CRYPTO_malloc(num, file, line);
        170.   

crypto/mem.c:169:9: 
        167.   {
        168.       if (str == NULL)
        169. >         return CRYPTO_malloc(num, file, line);
        170.   
        171.       if (num == 0) {

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

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

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

crypto/mem.c:125:9: 
          123.   
          124.       if (num <= 0)
          125. >         return NULL;
          126.   
          127.       allow_customize = 0;

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

crypto/mem.c:191:1: return from a call to CRYPTO_realloc
        189.       return realloc(str, num);
        190.   
        191. > }
        192.   
        193.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/stack/stack.c:176:13: Taking true branch
      174.           s = OPENSSL_realloc((char *)st->data,
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      176.           if (s == NULL)
                         ^
      177.               return (0);
      178.           st->data = s;

crypto/stack/stack.c:177:13: 
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      176.           if (s == NULL)
      177. >             return (0);
      178.           st->data = s;
      179.           st->num_alloc *= 2;

crypto/stack/stack.c:191:1: return from a call to sk_insert
      189.       st->sorted = 0;
      190.       return (st->num);
      191. > }
      192.   
      193.   void *sk_delete_ptr(_STACK *st, void *p)

crypto/stack/stack.c:262:1: return from a call to sk_push
    260.   {
    261.       return (sk_insert(st, data, st->num));
    262. > }
    263.   
    264.   int sk_unshift(_STACK *st, void *data)

include/openssl/x509_vfy.h:124:1: return from a call to sk_X509_OBJECT_push
  122.   
  123.   DEFINE_STACK_OF(X509_LOOKUP)
  124. > DEFINE_STACK_OF(X509_OBJECT)
  125.   
  126.   /* This is a static that defines the function interface */
