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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/o_str.c:28:1: start of procedure CRYPTO_strdup()
    26.   }
    27.   
    28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    29.   {
    30.       char *ret;

crypto/o_str.c:33:9: Taking false branch
    31.       size_t size;
    32.   
    33.       if (str == NULL)
                  ^
    34.           return NULL;
    35.       size = strlen(str) + 1;

crypto/o_str.c:35:5: 
    33.       if (str == NULL)
    34.           return NULL;
    35. >     size = strlen(str) + 1;
    36.       ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)

crypto/o_str.c:36:5: 
    34.           return NULL;
    35.       size = strlen(str) + 1;
    36. >     ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)
    38.           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:37:9: Taking true branch
    35.       size = strlen(str) + 1;
    36.       ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)
                  ^
    38.           memcpy(ret, str, size);
    39.       return ret;

crypto/o_str.c:38:9: 
    36.       ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)
    38. >         memcpy(ret, str, size);
    39.       return ret;
    40.   }

crypto/o_str.c:39:5: 
    37.       if (ret != NULL)
    38.           memcpy(ret, str, size);
    39. >     return ret;
    40.   }
    41.   

crypto/o_str.c:40:1: return from a call to CRYPTO_strdup
    38.           memcpy(ret, str, size);
    39.       return ret;
    40. > }
    41.   
    42.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

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

crypto/dso/dso_lib.c:257:5: 
  255.           return (0);
  256.       }
  257. >     OPENSSL_free(dso->filename);
  258.       dso->filename = copied;
  259.       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:258:5: 
  256.       }
  257.       OPENSSL_free(dso->filename);
  258. >     dso->filename = copied;
  259.       return (1);
  260.   }

crypto/dso/dso_lib.c:259:5: 
  257.       OPENSSL_free(dso->filename);
  258.       dso->filename = copied;
  259. >     return (1);
  260.   }
  261.   

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

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

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

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

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

crypto/dso/dso_lib.c:160:10: Skipping __function_pointer__(): unresolved function pointer
158.           goto err;
159.       }
160.       if (!ret->meth->dso_load(ret)) {
                ^
161.           DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);
162.           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}']