crypto/dso/dso_lib.c:157: error: MEMORY_LEAK
  memory dynamically allocated by call to `DSO_set_filename()` at line 144, column 14 is not reachable after line 157, column 10.
Showing all 56 steps of the trace


crypto/dso/dso_lib.c:115:1: start of procedure DSO_load()
113.   }
114.   
115. > DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
116.   {
117.       DSO *ret;

crypto/dso/dso_lib.c:118:5: 
116.   {
117.       DSO *ret;
118. >     int allocated = 0;
119.   
120.       if (dso == NULL) {

crypto/dso/dso_lib.c:120:9: Taking true branch
118.       int allocated = 0;
119.   
120.       if (dso == NULL) {
               ^
121.           ret = DSO_new_method(meth);
122.           if (ret == NULL) {

crypto/dso/dso_lib.c:121:9: Skipping DSO_new_method(): empty list of specs
119.   
120.       if (dso == NULL) {
121.           ret = DSO_new_method(meth);
               ^
122.           if (ret == NULL) {
123.               DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);

crypto/dso/dso_lib.c:122:13: Taking false branch
120.       if (dso == NULL) {
121.           ret = DSO_new_method(meth);
122.           if (ret == NULL) {
                   ^
123.               DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);
124.               goto err;

crypto/dso/dso_lib.c:126:9: 
124.               goto err;
125.           }
126. >         allocated = 1;
127.           /* Pass the provided flags to the new DSO object */
128.           if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {

crypto/dso/dso_lib.c:128:13: 
126.           allocated = 1;
127.           /* Pass the provided flags to the new DSO object */
128. >         if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {
129.               DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);
130.               goto err;

crypto/dso/dso_lib.c:198:1: start of procedure DSO_ctrl()
  196.    * value as success/failure like usual ... but we conform when we must... :-)
  197.    */
  198. > long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
  199.   {
  200.       if (dso == NULL) {

crypto/dso/dso_lib.c:200:9: Taking false branch
  198.   long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
  199.   {
  200.       if (dso == NULL) {
                 ^
  201.           DSOerr(DSO_F_DSO_CTRL, ERR_R_PASSED_NULL_PARAMETER);
  202.           return (-1);

crypto/dso/dso_lib.c:208:5: 
  206.        * the method-specific ctrl() function if it's something we don't handle.
  207.        */
  208. >     switch (cmd) {
  209.       case DSO_CTRL_GET_FLAGS:
  210.           return dso->flags;

crypto/dso/dso_lib.c:209:5: Switch condition is false. Skipping switch case
  207.        */
  208.       switch (cmd) {
  209.       case DSO_CTRL_GET_FLAGS:
             ^
  210.           return dso->flags;
  211.       case DSO_CTRL_SET_FLAGS:

crypto/dso/dso_lib.c:211:5: Switch condition is true. Entering switch case
  209.       case DSO_CTRL_GET_FLAGS:
  210.           return dso->flags;
  211.       case DSO_CTRL_SET_FLAGS:
             ^
  212.           dso->flags = (int)larg;
  213.           return (0);

crypto/dso/dso_lib.c:212:9: 
  210.           return dso->flags;
  211.       case DSO_CTRL_SET_FLAGS:
  212. >         dso->flags = (int)larg;
  213.           return (0);
  214.       case DSO_CTRL_OR_FLAGS:

crypto/dso/dso_lib.c:213:9: 
  211.       case DSO_CTRL_SET_FLAGS:
  212.           dso->flags = (int)larg;
  213. >         return (0);
  214.       case DSO_CTRL_OR_FLAGS:
  215.           dso->flags |= (int)larg;

crypto/dso/dso_lib.c:225:1: return from a call to DSO_ctrl
  223.       }
  224.       return (dso->meth->dso_ctrl(dso, cmd, larg, parg));
  225. > }
  226.   
  227.   const char *DSO_get_filename(DSO *dso)

crypto/dso/dso_lib.c:128:13: Taking false branch
126.           allocated = 1;
127.           /* Pass the provided flags to the new DSO object */
128.           if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {
                   ^
129.               DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);
130.               goto err;

crypto/dso/dso_lib.c:135:9: Taking false branch
133.           ret = dso;
134.       /* Don't load if we're currently already loaded */
135.       if (ret->filename != NULL) {
               ^
136.           DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED);
137.           goto err;

crypto/dso/dso_lib.c:143:9: Taking true branch
141.        * set.
142.        */
143.       if (filename != NULL)
               ^
144.           if (!DSO_set_filename(ret, filename)) {
145.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);

crypto/dso/dso_lib.c:144:14: 
142.        */
143.       if (filename != NULL)
144. >         if (!DSO_set_filename(ret, filename)) {
145.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
146.               goto err;

crypto/dso/dso_lib.c:236:1: start of procedure DSO_set_filename()
  234.   }
  235.   
  236. > int DSO_set_filename(DSO *dso, const char *filename)
  237.   {
  238.       char *copied;

crypto/dso/dso_lib.c:240:10: Taking false branch
  238.       char *copied;
  239.   
  240.       if ((dso == NULL) || (filename == NULL)) {
                  ^
  241.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
  242.           return (0);

crypto/dso/dso_lib.c:240:27: Taking false branch
  238.       char *copied;
  239.   
  240.       if ((dso == NULL) || (filename == NULL)) {
                                   ^
  241.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
  242.           return (0);

crypto/dso/dso_lib.c:244:9: Taking false branch
  242.           return (0);
  243.       }
  244.       if (dso->loaded_filename) {
                 ^
  245.           DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED);
  246.           return (0);

crypto/dso/dso_lib.c:249:5: 
  247.       }
  248.       /* We'll duplicate filename */
  249. >     copied = OPENSSL_strdup(filename);
  250.       if (copied == NULL) {
  251.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);

crypto/o_str.c:71:1: start of procedure CRYPTO_strdup()
    69.   }
    70.   
    71. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    72.   {
    73.       char *ret;

crypto/o_str.c:76:9: Taking false branch
    74.       size_t size;
    75.   
    76.       if (str == NULL)
                  ^
    77.           return NULL;
    78.       size = strlen(str) + 1;

crypto/o_str.c:78:5: 
    76.       if (str == NULL)
    77.           return NULL;
    78. >     size = strlen(str) + 1;
    79.       ret = CRYPTO_malloc(size, file, line);
    80.       if (ret != NULL)

crypto/o_str.c:79:5: 
    77.           return NULL;
    78.       size = strlen(str) + 1;
    79. >     ret = CRYPTO_malloc(size, file, line);
    80.       if (ret != NULL)
    81.           memcpy(ret, str, size);

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/o_str.c:80:9: Taking true branch
    78.       size = strlen(str) + 1;
    79.       ret = CRYPTO_malloc(size, file, line);
    80.       if (ret != NULL)
                  ^
    81.           memcpy(ret, str, size);
    82.       return ret;

crypto/o_str.c:81:9: 
    79.       ret = CRYPTO_malloc(size, file, line);
    80.       if (ret != NULL)
    81. >         memcpy(ret, str, size);
    82.       return ret;
    83.   }

crypto/o_str.c:82:5: 
    80.       if (ret != NULL)
    81.           memcpy(ret, str, size);
    82. >     return ret;
    83.   }
    84.   

crypto/o_str.c:83:1: return from a call to CRYPTO_strdup
    81.           memcpy(ret, str, size);
    82.       return ret;
    83. > }
    84.   
    85.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/dso/dso_lib.c:250:9: Taking false branch
  248.       /* We'll duplicate filename */
  249.       copied = OPENSSL_strdup(filename);
  250.       if (copied == NULL) {
                 ^
  251.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);
  252.           return (0);

crypto/dso/dso_lib.c:254:5: 
  252.           return (0);
  253.       }
  254. >     OPENSSL_free(dso->filename);
  255.       dso->filename = copied;
  256.       return (1);

crypto/mem.c:163:1: start of procedure CRYPTO_free()
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking false branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:179:5: 
    177.       }
    178.   #else
    179. >     free(str);
    180.   #endif
    181.   }

crypto/mem.c:181:1: return from a call to CRYPTO_free
    179.       free(str);
    180.   #endif
    181. > }
    182.   
    183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/dso/dso_lib.c:255:5: 
  253.       }
  254.       OPENSSL_free(dso->filename);
  255. >     dso->filename = copied;
  256.       return (1);
  257.   }

crypto/dso/dso_lib.c:256:5: 
  254.       OPENSSL_free(dso->filename);
  255.       dso->filename = copied;
  256. >     return (1);
  257.   }
  258.   

crypto/dso/dso_lib.c:257:1: return from a call to DSO_set_filename
  255.       dso->filename = copied;
  256.       return (1);
  257. > }
  258.   
  259.   char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2)

crypto/dso/dso_lib.c:144:14: Taking false branch
142.        */
143.       if (filename != NULL)
144.           if (!DSO_set_filename(ret, filename)) {
                    ^
145.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
146.               goto err;

crypto/dso/dso_lib.c:148:5: 
146.               goto err;
147.           }
148. >     filename = ret->filename;
149.       if (filename == NULL) {
150.           DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);

crypto/dso/dso_lib.c:149:9: Taking false branch
147.           }
148.       filename = ret->filename;
149.       if (filename == NULL) {
               ^
150.           DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);
151.           goto err;

crypto/dso/dso_lib.c:153:9: Taking false branch
151.           goto err;
152.       }
153.       if (ret->meth->dso_load == NULL) {
               ^
154.           DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);
155.           goto err;

crypto/dso/dso_lib.c:157:10: Skipping __function_pointer__(): unresolved function pointer
155.           goto err;
156.       }
157.       if (!ret->meth->dso_load(ret)) {
                ^
158.           DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);
159.           goto err;

DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
{
    DSO *ret;
    int allocated = 0;
    if (dso == NULL) {
        ret = DSO_new_method(meth);
        if (ret == NULL) {
            DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);
            goto err;
        }
        allocated = 1;
        if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {
            DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);
            goto err;
        }
    } else
        ret = dso;
    if (ret->filename != NULL) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED);
        goto err;
    }
    if (filename != NULL)
        if (!DSO_set_filename(ret, filename)) {
            DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
            goto err;
        }
    filename = ret->filename;
    if (filename == NULL) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);
        goto err;
    }
    if (ret->meth->dso_load == NULL) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);
        goto err;
    }
    if (!ret->meth->dso_load(ret)) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);
        goto err;
    }
    return (ret);
 err:
    if (allocated)
        DSO_free(ret);
    return (NULL);
}
['DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)\n{\n    DSO *ret;\n    int allocated = 0;\n    if (dso == NULL) {\n        ret = DSO_new_method(meth);\n        if (ret == NULL) {\n            DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        allocated = 1;\n        if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {\n            DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);\n            goto err;\n        }\n    } else\n        ret = dso;\n    if (ret->filename != NULL) {\n        DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED);\n        goto err;\n    }\n    if (filename != NULL)\n        if (!DSO_set_filename(ret, filename)) {\n            DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);\n            goto err;\n        }\n    filename = ret->filename;\n    if (filename == NULL) {\n        DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);\n        goto err;\n    }\n    if (ret->meth->dso_load == NULL) {\n        DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);\n        goto err;\n    }\n    if (!ret->meth->dso_load(ret)) {\n        DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);\n        goto err;\n    }\n    return (ret);\n err:\n    if (allocated)\n        DSO_free(ret);\n    return (NULL);\n}', 'long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)\n{\n    if (dso == NULL) {\n        DSOerr(DSO_F_DSO_CTRL, ERR_R_PASSED_NULL_PARAMETER);\n        return (-1);\n    }\n    switch (cmd) {\n    case DSO_CTRL_GET_FLAGS:\n        return dso->flags;\n    case DSO_CTRL_SET_FLAGS:\n        dso->flags = (int)larg;\n        return (0);\n    case DSO_CTRL_OR_FLAGS:\n        dso->flags |= (int)larg;\n        return (0);\n    default:\n        break;\n    }\n    if ((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL)) {\n        DSOerr(DSO_F_DSO_CTRL, DSO_R_UNSUPPORTED);\n        return (-1);\n    }\n    return (dso->meth->dso_ctrl(dso, cmd, larg, parg));\n}', 'int DSO_set_filename(DSO *dso, const char *filename)\n{\n    char *copied;\n    if ((dso == NULL) || (filename == NULL)) {\n        DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);\n        return (0);\n    }\n    if (dso->loaded_filename) {\n        DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED);\n        return (0);\n    }\n    copied = OPENSSL_strdup(filename);\n    if (copied == NULL) {\n        DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);\n        return (0);\n    }\n    OPENSSL_free(dso->filename);\n    dso->filename = copied;\n    return (1);\n}', 'char *CRYPTO_strdup(const char *str, const char* file, int line)\n{\n    char *ret;\n    size_t size;\n    if (str == NULL)\n        return NULL;\n    size = strlen(str) + 1;\n    ret = CRYPTO_malloc(size, file, line);\n    if (ret != NULL)\n        memcpy(ret, str, size);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\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    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']