crypto/dso/dso_lib.c:124: error: MEMORY_LEAK
  memory dynamically allocated by call to `sk_void_new_null()` at line 112, column 22 is not reachable after line 124, column 39.
Showing all 70 steps of the trace


crypto/dso/dso_lib.c:95:1: start of procedure DSO_new_method()
93.   }
94.   
95. > DSO *DSO_new_method(DSO_METHOD *meth)
96.   {
97.       DSO *ret;

crypto/dso/dso_lib.c:99:9: Taking false branch
97.       DSO *ret;
98.   
99.       if (default_DSO_meth == NULL) {
               ^
100.           /*
101.            * We default to DSO_METH_openssl() which in turn defaults to

crypto/dso/dso_lib.c:107:5: 
105.           default_DSO_meth = DSO_METHOD_openssl();
106.       }
107. >     ret = OPENSSL_zalloc(sizeof(*ret));
108.       if (ret == NULL) {
109.           DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);

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

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

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.   #ifndef OPENSSL_NO_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/mem.c:161:9: Taking true branch
  159.       void *ret = CRYPTO_malloc(num, file, line);
  160.   
  161.       if (ret != NULL)
                 ^
  162.           memset(ret, 0, num);
  163.       return ret;

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

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

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

crypto/dso/dso_lib.c:108:9: Taking false branch
106.       }
107.       ret = OPENSSL_zalloc(sizeof(*ret));
108.       if (ret == NULL) {
               ^
109.           DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
110.           return (NULL);

crypto/dso/dso_lib.c:112:5: 
110.           return (NULL);
111.       }
112. >     ret->meth_data = sk_void_new_null();
113.       if (ret->meth_data == NULL) {
114.           /* sk_new doesn't generate any errors so we do */

include/openssl/crypto.h:263:1: start of procedure sk_void_new_null()
  261.       STACK_OF(void) *sk;
  262.   };
  263. > DEFINE_STACK_OF(void)
  264.   
  265.   /*

crypto/stack/stack.c:145:1: start of procedure sk_new_null()
    143.   }
    144.   
    145. > _STACK *sk_new_null(void)
    146.   {
    147.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:147:5: 
    145.   _STACK *sk_new_null(void)
    146.   {
    147. >     return sk_new((int (*)(const void *, const void *))0);
    148.   }
    149.   

crypto/stack/stack.c:150:1: start of procedure sk_new()
      148.   }
      149.   
      150. > _STACK *sk_new(int (*c) (const void *, const void *))
      151.   {
      152.       _STACK *ret;

crypto/stack/stack.c:154:9: 
      152.       _STACK *ret;
      153.   
      154. >     if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      155.           goto err;
      156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

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

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

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.   #ifndef OPENSSL_NO_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/mem.c:161:9: Taking true branch
        159.       void *ret = CRYPTO_malloc(num, file, line);
        160.   
        161.       if (ret != NULL)
                       ^
        162.           memset(ret, 0, num);
        163.       return ret;

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

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

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

crypto/stack/stack.c:154:9: Taking false branch
      152.       _STACK *ret;
      153.   
      154.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
                     ^
      155.           goto err;
      156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

crypto/stack/stack.c:156:9: 
      154.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      155.           goto err;
      156. >     if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
      157.           goto err;
      158.       ret->comp = c;

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

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

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.   #ifndef OPENSSL_NO_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/mem.c:161:9: Taking true branch
        159.       void *ret = CRYPTO_malloc(num, file, line);
        160.   
        161.       if (ret != NULL)
                       ^
        162.           memset(ret, 0, num);
        163.       return ret;

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

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

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

crypto/stack/stack.c:156:9: Taking false branch
      154.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      155.           goto err;
      156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
                     ^
      157.           goto err;
      158.       ret->comp = c;

crypto/stack/stack.c:158:5: 
      156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
      157.           goto err;
      158. >     ret->comp = c;
      159.       ret->num_alloc = MIN_NODES;
      160.       return (ret);

crypto/stack/stack.c:159:5: 
      157.           goto err;
      158.       ret->comp = c;
      159. >     ret->num_alloc = MIN_NODES;
      160.       return (ret);
      161.   

crypto/stack/stack.c:160:5: 
      158.       ret->comp = c;
      159.       ret->num_alloc = MIN_NODES;
      160. >     return (ret);
      161.   
      162.    err:

crypto/stack/stack.c:165:1: return from a call to sk_new
      163.       OPENSSL_free(ret);
      164.       return (NULL);
      165. > }
      166.   
      167.   int sk_insert(_STACK *st, void *data, int loc)

crypto/stack/stack.c:148:1: return from a call to sk_new_null
    146.   {
    147.       return sk_new((int (*)(const void *, const void *))0);
    148. > }
    149.   
    150.   _STACK *sk_new(int (*c) (const void *, const void *))

include/openssl/crypto.h:263:1: return from a call to sk_void_new_null
  261.       STACK_OF(void) *sk;
  262.   };
  263. > DEFINE_STACK_OF(void)
  264.   
  265.   /*

crypto/dso/dso_lib.c:113:9: Taking false branch
111.       }
112.       ret->meth_data = sk_void_new_null();
113.       if (ret->meth_data == NULL) {
               ^
114.           /* sk_new doesn't generate any errors so we do */
115.           DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);

crypto/dso/dso_lib.c:119:9: Taking false branch
117.           return (NULL);
118.       }
119.       if (meth == NULL)
               ^
120.           ret->meth = default_DSO_meth;
121.       else

crypto/dso/dso_lib.c:122:9: 
120.           ret->meth = default_DSO_meth;
121.       else
122. >         ret->meth = meth;
123.       ret->references = 1;
124.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {

crypto/dso/dso_lib.c:123:5: 
121.       else
122.           ret->meth = meth;
123. >     ret->references = 1;
124.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
125.           sk_void_free(ret->meth_data);

crypto/dso/dso_lib.c:124:10: Taking true branch
122.           ret->meth = meth;
123.       ret->references = 1;
124.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
                ^
125.           sk_void_free(ret->meth_data);
126.           OPENSSL_free(ret);

crypto/dso/dso_lib.c:124:39: Skipping __function_pointer__(): unresolved function pointer
122.           ret->meth = meth;
123.       ret->references = 1;
124.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
                                             ^
125.           sk_void_free(ret->meth_data);
126.           OPENSSL_free(ret);

DSO *DSO_new_method(DSO_METHOD *meth)
{
    DSO *ret;
    if (default_DSO_meth == NULL) {
        default_DSO_meth = DSO_METHOD_openssl();
    }
    ret = OPENSSL_zalloc(sizeof(*ret));
    if (ret == NULL) {
        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        return (NULL);
    }
    ret->meth_data = sk_void_new_null();
    if (ret->meth_data == NULL) {
        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        OPENSSL_free(ret);
        return (NULL);
    }
    if (meth == NULL)
        ret->meth = default_DSO_meth;
    else
        ret->meth = meth;
    ret->references = 1;
    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
        sk_void_free(ret->meth_data);
        OPENSSL_free(ret);
        ret = NULL;
    }
    return (ret);
}
['DSO *DSO_new_method(DSO_METHOD *meth)\n{\n    DSO *ret;\n    if (default_DSO_meth == NULL) {\n        default_DSO_meth = DSO_METHOD_openssl();\n    }\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->meth_data = sk_void_new_null();\n    if (ret->meth_data == NULL) {\n        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);\n        OPENSSL_free(ret);\n        return (NULL);\n    }\n    if (meth == NULL)\n        ret->meth = default_DSO_meth;\n    else\n        ret->meth = meth;\n    ret->references = 1;\n    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {\n        sk_void_free(ret->meth_data);\n        OPENSSL_free(ret);\n        ret = NULL;\n    }\n    return (ret);\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'DEFINE_STACK_OF(void)', '_STACK *sk_new_null(void)\n{\n    return sk_new((int (*)(const void *, const void *))0);\n}', '_STACK *sk_new(int (*c) (const void *, const void *))\n{\n    _STACK *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)\n        goto err;\n    if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)\n        goto err;\n    ret->comp = c;\n    ret->num_alloc = MIN_NODES;\n    return (ret);\n err:\n    OPENSSL_free(ret);\n    return (NULL);\n}']