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


crypto/dso/dso_lib.c:184:1: start of procedure DSO_load()
182.   }
183.   
184. > DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
185.   {
186.       DSO *ret;

crypto/dso/dso_lib.c:187:5: 
185.   {
186.       DSO *ret;
187. >     int allocated = 0;
188.   
189.       if (dso == NULL) {

crypto/dso/dso_lib.c:189:9: Taking false branch
187.       int allocated = 0;
188.   
189.       if (dso == NULL) {
               ^
190.           ret = DSO_new_method(meth);
191.           if (ret == NULL) {

crypto/dso/dso_lib.c:202:9: 
200.           }
201.       } else
202. >         ret = dso;
203.       /* Don't load if we're currently already loaded */
204.       if (ret->filename != NULL) {

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

crypto/dso/dso_lib.c:212:9: Taking true branch
210.        * set.
211.        */
212.       if (filename != NULL)
               ^
213.           if (!DSO_set_filename(ret, filename)) {
214.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);

crypto/dso/dso_lib.c:213:14: 
211.        */
212.       if (filename != NULL)
213. >         if (!DSO_set_filename(ret, filename)) {
214.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
215.               goto err;

crypto/dso/dso_lib.c:338:1: start of procedure DSO_set_filename()
  336.   }
  337.   
  338. > int DSO_set_filename(DSO *dso, const char *filename)
  339.   {
  340.       char *copied;

crypto/dso/dso_lib.c:342:10: Taking false branch
  340.       char *copied;
  341.   
  342.       if ((dso == NULL) || (filename == NULL)) {
                  ^
  343.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
  344.           return (0);

crypto/dso/dso_lib.c:342:27: Taking false branch
  340.       char *copied;
  341.   
  342.       if ((dso == NULL) || (filename == NULL)) {
                                   ^
  343.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
  344.           return (0);

crypto/dso/dso_lib.c:346:9: Taking false branch
  344.           return (0);
  345.       }
  346.       if (dso->loaded_filename) {
                 ^
  347.           DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED);
  348.           return (0);

crypto/dso/dso_lib.c:351:5: 
  349.       }
  350.       /* We'll duplicate filename */
  351. >     copied = OPENSSL_malloc(strlen(filename) + 1);
  352.       if (copied == NULL) {
  353.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);

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/dso/dso_lib.c:352:9: Taking false branch
  350.       /* We'll duplicate filename */
  351.       copied = OPENSSL_malloc(strlen(filename) + 1);
  352.       if (copied == NULL) {
                 ^
  353.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);
  354.           return (0);

crypto/dso/dso_lib.c:356:5: Skipping OPENSSL_strlcpy(): empty list of specs
  354.           return (0);
  355.       }
  356.       OPENSSL_strlcpy(copied, filename, strlen(filename) + 1);
             ^
  357.       OPENSSL_free(dso->filename);
  358.       dso->filename = copied;

crypto/dso/dso_lib.c:357:5: 
  355.       }
  356.       OPENSSL_strlcpy(copied, filename, strlen(filename) + 1);
  357. >     OPENSSL_free(dso->filename);
  358.       dso->filename = copied;
  359.       return (1);

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)

crypto/dso/dso_lib.c:358:5: 
  356.       OPENSSL_strlcpy(copied, filename, strlen(filename) + 1);
  357.       OPENSSL_free(dso->filename);
  358. >     dso->filename = copied;
  359.       return (1);
  360.   }

crypto/dso/dso_lib.c:359:5: 
  357.       OPENSSL_free(dso->filename);
  358.       dso->filename = copied;
  359. >     return (1);
  360.   }
  361.   

crypto/dso/dso_lib.c:360:1: return from a call to DSO_set_filename
  358.       dso->filename = copied;
  359.       return (1);
  360. > }
  361.   
  362.   char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2)

crypto/dso/dso_lib.c:213:14: Taking false branch
211.        */
212.       if (filename != NULL)
213.           if (!DSO_set_filename(ret, filename)) {
                    ^
214.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
215.               goto err;

crypto/dso/dso_lib.c:217:5: 
215.               goto err;
216.           }
217. >     filename = ret->filename;
218.       if (filename == NULL) {
219.           DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);

crypto/dso/dso_lib.c:218:9: Taking false branch
216.           }
217.       filename = ret->filename;
218.       if (filename == NULL) {
               ^
219.           DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);
220.           goto err;

crypto/dso/dso_lib.c:222:9: Taking false branch
220.           goto err;
221.       }
222.       if (ret->meth->dso_load == NULL) {
               ^
223.           DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);
224.           goto err;

crypto/dso/dso_lib.c:226:10: Skipping __function_pointer__(): unresolved function pointer
224.           goto err;
225.       }
226.       if (!ret->meth->dso_load(ret)) {
                ^
227.           DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);
228.           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}', '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_malloc(strlen(filename) + 1);\n    if (copied == NULL) {\n        DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);\n        return (0);\n    }\n    OPENSSL_strlcpy(copied, filename, strlen(filename) + 1);\n    OPENSSL_free(dso->filename);\n    dso->filename = copied;\n    return (1);\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}', '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}']