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


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

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

crypto/dso/dso_lib.c:106:5: 
104.           default_DSO_meth = DSO_METHOD_openssl();
105.       }
106. >     ret = OPENSSL_zalloc(sizeof(*ret));
107.       if (ret == NULL) {
108.           DSOerr(DSO_F_DSO_NEW_METHOD, 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/dso/dso_lib.c:107:9: Taking false branch
105.       }
106.       ret = OPENSSL_zalloc(sizeof(*ret));
107.       if (ret == NULL) {
               ^
108.           DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
109.           return (NULL);

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

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

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

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

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

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

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/stack/stack.c:153:9: Taking false branch
      151.       _STACK *ret;
      152.   
      153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
                     ^
      154.           goto err;
      155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

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

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/stack/stack.c:155:9: Taking false branch
      153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      154.           goto err;
      155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
                     ^
      156.           goto err;
      157.       ret->comp = c;

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

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

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

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

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

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

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

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

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

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

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

crypto/dso/dso_lib.c:123:39: Skipping __function_pointer__(): unresolved function pointer
121.           ret->meth = meth;
122.       ret->references = 1;
123.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
                                             ^
124.           sk_void_free(ret->meth_data);
125.           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}']