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


crypto/dso/dso_lib.c:194:1: start of procedure DSO_load()
192.   }
193.   
194. > DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
195.   {
196.       DSO *ret;

crypto/dso/dso_lib.c:197:5: 
195.   {
196.       DSO *ret;
197. >     int allocated = 0;
198.   
199.       if (dso == NULL) {

crypto/dso/dso_lib.c:199:9: Taking true branch
197.       int allocated = 0;
198.   
199.       if (dso == NULL) {
               ^
200.           ret = DSO_new_method(meth);
201.           if (ret == NULL) {

crypto/dso/dso_lib.c:200:9: Skipping DSO_new_method(): empty list of specs
198.   
199.       if (dso == NULL) {
200.           ret = DSO_new_method(meth);
               ^
201.           if (ret == NULL) {
202.               DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);

crypto/dso/dso_lib.c:201:13: Taking false branch
199.       if (dso == NULL) {
200.           ret = DSO_new_method(meth);
201.           if (ret == NULL) {
                   ^
202.               DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);
203.               goto err;

crypto/dso/dso_lib.c:205:9: 
203.               goto err;
204.           }
205. >         allocated = 1;
206.           /* Pass the provided flags to the new DSO object */
207.           if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {

crypto/dso/dso_lib.c:207:13: 
205.           allocated = 1;
206.           /* Pass the provided flags to the new DSO object */
207. >         if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {
208.               DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);
209.               goto err;

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

crypto/dso/dso_lib.c:299:9: Taking false branch
  297.   long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
  298.   {
  299.       if (dso == NULL) {
                 ^
  300.           DSOerr(DSO_F_DSO_CTRL, ERR_R_PASSED_NULL_PARAMETER);
  301.           return (-1);

crypto/dso/dso_lib.c:307:5: 
  305.        * the method-specific ctrl() function if it's something we don't handle.
  306.        */
  307. >     switch (cmd) {
  308.       case DSO_CTRL_GET_FLAGS:
  309.           return dso->flags;

crypto/dso/dso_lib.c:308:5: Switch condition is false. Skipping switch case
  306.        */
  307.       switch (cmd) {
  308.       case DSO_CTRL_GET_FLAGS:
             ^
  309.           return dso->flags;
  310.       case DSO_CTRL_SET_FLAGS:

crypto/dso/dso_lib.c:310:5: Switch condition is true. Entering switch case
  308.       case DSO_CTRL_GET_FLAGS:
  309.           return dso->flags;
  310.       case DSO_CTRL_SET_FLAGS:
             ^
  311.           dso->flags = (int)larg;
  312.           return (0);

crypto/dso/dso_lib.c:311:9: 
  309.           return dso->flags;
  310.       case DSO_CTRL_SET_FLAGS:
  311. >         dso->flags = (int)larg;
  312.           return (0);
  313.       case DSO_CTRL_OR_FLAGS:

crypto/dso/dso_lib.c:312:9: 
  310.       case DSO_CTRL_SET_FLAGS:
  311.           dso->flags = (int)larg;
  312. >         return (0);
  313.       case DSO_CTRL_OR_FLAGS:
  314.           dso->flags |= (int)larg;

crypto/dso/dso_lib.c:324:1: return from a call to DSO_ctrl
  322.       }
  323.       return (dso->meth->dso_ctrl(dso, cmd, larg, parg));
  324. > }
  325.   
  326.   int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,

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

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

crypto/dso/dso_lib.c:222:9: Taking true branch
220.        * set.
221.        */
222.       if (filename != NULL)
               ^
223.           if (!DSO_set_filename(ret, filename)) {
224.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);

crypto/dso/dso_lib.c:223:14: 
221.        */
222.       if (filename != NULL)
223. >         if (!DSO_set_filename(ret, filename)) {
224.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
225.               goto err;

crypto/dso/dso_lib.c:348:1: start of procedure DSO_set_filename()
  346.   }
  347.   
  348. > int DSO_set_filename(DSO *dso, const char *filename)
  349.   {
  350.       char *copied;

crypto/dso/dso_lib.c:352:10: Taking false branch
  350.       char *copied;
  351.   
  352.       if ((dso == NULL) || (filename == NULL)) {
                  ^
  353.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
  354.           return (0);

crypto/dso/dso_lib.c:352:27: Taking false branch
  350.       char *copied;
  351.   
  352.       if ((dso == NULL) || (filename == NULL)) {
                                   ^
  353.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
  354.           return (0);

crypto/dso/dso_lib.c:356:9: Taking false branch
  354.           return (0);
  355.       }
  356.       if (dso->loaded_filename) {
                 ^
  357.           DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED);
  358.           return (0);

crypto/dso/dso_lib.c:361:5: 
  359.       }
  360.       /* We'll duplicate filename */
  361. >     copied = OPENSSL_strdup(filename);
  362.       if (copied == NULL) {
  363.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);

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:125:9: Taking false branch
    123.       size_t size;
    124.   
    125.       if (str == NULL)
                   ^
    126.           return NULL;
    127.       size = strlen(str) + 1;

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

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

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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:139:24: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:140:5: 
      138.   #else
      139.       osslargused(file); osslargused(line);
      140. >     ret = malloc(num);
      141.   #endif
      142.   

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/o_str.c:129:9: Taking true branch
    127.       size = strlen(str) + 1;
    128.       ret = CRYPTO_malloc(size, file, line);
    129.       if (ret != NULL)
                   ^
    130.           memcpy(ret, str, size);
    131.       return ret;

crypto/o_str.c:130:9: 
    128.       ret = CRYPTO_malloc(size, file, line);
    129.       if (ret != NULL)
    130. >         memcpy(ret, str, size);
    131.       return ret;
    132.   }

crypto/o_str.c:131:5: 
    129.       if (ret != NULL)
    130.           memcpy(ret, str, size);
    131. >     return ret;
    132.   }
    133.   

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

crypto/dso/dso_lib.c:362:9: Taking false branch
  360.       /* We'll duplicate filename */
  361.       copied = OPENSSL_strdup(filename);
  362.       if (copied == NULL) {
                 ^
  363.           DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);
  364.           return (0);

crypto/dso/dso_lib.c:366:5: 
  364.           return (0);
  365.       }
  366. >     OPENSSL_free(dso->filename);
  367.       dso->filename = copied;
  368.       return (1);

crypto/mem.c:210:1: start of procedure CRYPTO_free()
    208.   }
    209.   
    210. > void CRYPTO_free(void *str, const char *file, int line)
    211.   {
    212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:212:9: Taking false branch
    210.   void CRYPTO_free(void *str, const char *file, int line)
    211.   {
    212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    213.           free_impl(str, file, line);
    214.           return;

crypto/mem.c:226:5: 
    224.       }
    225.   #else
    226. >     free(str);
    227.   #endif
    228.   }

crypto/mem.c:228:1: return from a call to CRYPTO_free
    226.       free(str);
    227.   #endif
    228. > }
    229.   
    230.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/dso/dso_lib.c:367:5: 
  365.       }
  366.       OPENSSL_free(dso->filename);
  367. >     dso->filename = copied;
  368.       return (1);
  369.   }

crypto/dso/dso_lib.c:368:5: 
  366.       OPENSSL_free(dso->filename);
  367.       dso->filename = copied;
  368. >     return (1);
  369.   }
  370.   

crypto/dso/dso_lib.c:369:1: return from a call to DSO_set_filename
  367.       dso->filename = copied;
  368.       return (1);
  369. > }
  370.   
  371.   char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2)

crypto/dso/dso_lib.c:223:14: Taking false branch
221.        */
222.       if (filename != NULL)
223.           if (!DSO_set_filename(ret, filename)) {
                    ^
224.               DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
225.               goto err;

crypto/dso/dso_lib.c:227:5: 
225.               goto err;
226.           }
227. >     filename = ret->filename;
228.       if (filename == NULL) {
229.           DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);

crypto/dso/dso_lib.c:228:9: Taking false branch
226.           }
227.       filename = ret->filename;
228.       if (filename == NULL) {
               ^
229.           DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);
230.           goto err;

crypto/dso/dso_lib.c:232:9: Taking false branch
230.           goto err;
231.       }
232.       if (ret->meth->dso_load == NULL) {
               ^
233.           DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);
234.           goto err;

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