crypto/conf/conf_mod.c:293: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_strdup()` at line 288, column 18 is not reachable after line 293, column 9.
Showing all 68 steps of the trace


crypto/conf/conf_mod.c:275:1: start of procedure module_add()
273.   
274.   /* add module to list */
275. > static CONF_MODULE *module_add(DSO *dso, const char *name,
276.                                  conf_init_func *ifunc, conf_finish_func *ffunc)
277.   {

crypto/conf/conf_mod.c:278:5: 
276.                                  conf_init_func *ifunc, conf_finish_func *ffunc)
277.   {
278. >     CONF_MODULE *tmod = NULL;
279.       if (supported_modules == NULL)
280.           supported_modules = sk_CONF_MODULE_new_null();

crypto/conf/conf_mod.c:279:9: Taking false branch
277.   {
278.       CONF_MODULE *tmod = NULL;
279.       if (supported_modules == NULL)
               ^
280.           supported_modules = sk_CONF_MODULE_new_null();
281.       if (supported_modules == NULL)

crypto/conf/conf_mod.c:281:9: Taking false branch
279.       if (supported_modules == NULL)
280.           supported_modules = sk_CONF_MODULE_new_null();
281.       if (supported_modules == NULL)
               ^
282.           return NULL;
283.       tmod = OPENSSL_zalloc(sizeof(*tmod));

crypto/conf/conf_mod.c:283:5: 
281.       if (supported_modules == NULL)
282.           return NULL;
283. >     tmod = OPENSSL_zalloc(sizeof(*tmod));
284.       if (tmod == NULL)
285.           return 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/conf/conf_mod.c:284:9: Taking false branch
282.           return NULL;
283.       tmod = OPENSSL_zalloc(sizeof(*tmod));
284.       if (tmod == NULL)
               ^
285.           return NULL;
286.   

crypto/conf/conf_mod.c:287:5: 
285.           return NULL;
286.   
287. >     tmod->dso = dso;
288.       tmod->name = OPENSSL_strdup(name);
289.       tmod->init = ifunc;

crypto/conf/conf_mod.c:288:5: 
286.   
287.       tmod->dso = dso;
288. >     tmod->name = OPENSSL_strdup(name);
289.       tmod->init = ifunc;
290.       tmod->finish = ffunc;

crypto/o_str.c:120:1: start of procedure CRYPTO_strdup()
  118.   }
  119.   
  120. > char *CRYPTO_strdup(const char *str, const char* file, int line)
  121.   {
  122.       char *ret;

crypto/o_str.c:124:9: Taking false branch
  122.       char *ret;
  123.   
  124.       if (str == NULL)
                 ^
  125.           return NULL;
  126.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);

crypto/o_str.c:126:5: 
  124.       if (str == NULL)
  125.           return NULL;
  126. >     ret = CRYPTO_malloc(strlen(str) + 1, file, line);
  127.       if (ret != NULL)
  128.           strcpy(ret, str);

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/o_str.c:127:9: Taking true branch
  125.           return NULL;
  126.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
  127.       if (ret != NULL)
                 ^
  128.           strcpy(ret, str);
  129.       return ret;

crypto/o_str.c:128:9: 
  126.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
  127.       if (ret != NULL)
  128. >         strcpy(ret, str);
  129.       return ret;
  130.   }

crypto/o_str.c:129:5: 
  127.       if (ret != NULL)
  128.           strcpy(ret, str);
  129. >     return ret;
  130.   }
  131.   

crypto/o_str.c:130:1: return from a call to CRYPTO_strdup
  128.           strcpy(ret, str);
  129.       return ret;
  130. > }
  131.   
  132.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/conf/conf_mod.c:289:5: 
287.       tmod->dso = dso;
288.       tmod->name = OPENSSL_strdup(name);
289. >     tmod->init = ifunc;
290.       tmod->finish = ffunc;
291.   

crypto/conf/conf_mod.c:290:5: 
288.       tmod->name = OPENSSL_strdup(name);
289.       tmod->init = ifunc;
290. >     tmod->finish = ffunc;
291.   
292.       if (!sk_CONF_MODULE_push(supported_modules, tmod)) {

crypto/conf/conf_mod.c:292:10: 
290.       tmod->finish = ffunc;
291.   
292. >     if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
293.           OPENSSL_free(tmod);
294.           return NULL;

include/openssl/conf.h:104:1: start of procedure sk_CONF_MODULE_push()
  102.   typedef struct conf_module_st CONF_MODULE;
  103.   
  104. > DEFINE_STACK_OF(CONF_MODULE)
  105.   DEFINE_STACK_OF(CONF_IMODULE)
  106.   

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

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

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

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

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

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

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

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

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

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 true branch
          121.       void *ret = NULL;
          122.   
          123.       if (num <= 0)
                         ^
          124.           return NULL;
          125.   

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

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:190:1: return from a call to CRYPTO_realloc
        188.       return realloc(str, num);
        189.   
        190. > }
        191.   
        192.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

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

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

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

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

include/openssl/conf.h:104:1: return from a call to sk_CONF_MODULE_push
  102.   typedef struct conf_module_st CONF_MODULE;
  103.   
  104. > DEFINE_STACK_OF(CONF_MODULE)
  105.   DEFINE_STACK_OF(CONF_IMODULE)
  106.   

crypto/conf/conf_mod.c:292:10: Taking true branch
290.       tmod->finish = ffunc;
291.   
292.       if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
                ^
293.           OPENSSL_free(tmod);
294.           return NULL;

crypto/conf/conf_mod.c:293:9: 
291.   
292.       if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
293. >         OPENSSL_free(tmod);
294.           return NULL;
295.       }

crypto/mem.c:233:1: start of procedure CRYPTO_free()
  231.   }
  232.   
  233. > void CRYPTO_free(void *str)
  234.   {
  235.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:244:5: 
  242.       }
  243.   #else
  244. >     free(str);
  245.   #endif
  246.   }

crypto/mem.c:246:1: return from a call to CRYPTO_free
  244.       free(str);
  245.   #endif
  246. > }
  247.   
  248.   void CRYPTO_clear_free(void *str, size_t num)

static CONF_MODULE *module_add(DSO *dso, const char *name,
                               conf_init_func *ifunc, conf_finish_func *ffunc)
{
    CONF_MODULE *tmod = NULL;
    if (supported_modules == NULL)
        supported_modules = sk_CONF_MODULE_new_null();
    if (supported_modules == NULL)
        return NULL;
    tmod = OPENSSL_zalloc(sizeof(*tmod));
    if (tmod == NULL)
        return NULL;
    tmod->dso = dso;
    tmod->name = OPENSSL_strdup(name);
    tmod->init = ifunc;
    tmod->finish = ffunc;
    if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
        OPENSSL_free(tmod);
        return NULL;
    }
    return tmod;
}
['static CONF_MODULE *module_add(DSO *dso, const char *name,\n                               conf_init_func *ifunc, conf_finish_func *ffunc)\n{\n    CONF_MODULE *tmod = NULL;\n    if (supported_modules == NULL)\n        supported_modules = sk_CONF_MODULE_new_null();\n    if (supported_modules == NULL)\n        return NULL;\n    tmod = OPENSSL_zalloc(sizeof(*tmod));\n    if (tmod == NULL)\n        return NULL;\n    tmod->dso = dso;\n    tmod->name = OPENSSL_strdup(name);\n    tmod->init = ifunc;\n    tmod->finish = ffunc;\n    if (!sk_CONF_MODULE_push(supported_modules, tmod)) {\n        OPENSSL_free(tmod);\n        return NULL;\n    }\n    return tmod;\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}', 'char *CRYPTO_strdup(const char *str, const char* file, int line)\n{\n    char *ret;\n    if (str == NULL)\n        return NULL;\n    ret = CRYPTO_malloc(strlen(str) + 1, file, line);\n    if (ret != NULL)\n        strcpy(ret, str);\n    return ret;\n}', 'int sk_push(_STACK *st, void *data)\n{\n    return (sk_insert(st, data, st->num));\n}', 'int sk_insert(_STACK *st, void *data, int loc)\n{\n    char **s;\n    if (st == NULL)\n        return 0;\n    if (st->num_alloc <= st->num + 1) {\n        s = OPENSSL_realloc((char *)st->data,\n                            (unsigned int)sizeof(char *) * st->num_alloc * 2);\n        if (s == NULL)\n            return (0);\n        st->data = s;\n        st->num_alloc *= 2;\n    }\n    if ((loc >= (int)st->num) || (loc < 0))\n        st->data[st->num] = data;\n    else {\n        memmove(&(st->data[loc + 1]),\n                &(st->data[loc]), sizeof(char *) * (st->num - loc));\n        st->data[loc] = data;\n    }\n    st->num++;\n    st->sorted = 0;\n    return (st->num);\n}', 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)file;\n    (void)line;\n#endif\n    return realloc(str, num);\n}', 'void CRYPTO_free(void *str)\n{\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']