apps/apps.c:1830: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_strdup()` at line 1821, column 12 is not reachable after line 1830, column 5.
Showing all 39 steps of the trace


apps/apps.c:1817:1: start of procedure pkey_ctrl_string()
1815.   }
1816.   
1817. > int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
1818.   {
1819.       int rv;

apps/apps.c:1820:5: 
1818.   {
1819.       int rv;
1820. >     char *stmp, *vtmp = NULL;
1821.       stmp = OPENSSL_strdup(value);
1822.       if (!stmp)

apps/apps.c:1821:5: 
1819.       int rv;
1820.       char *stmp, *vtmp = NULL;
1821. >     stmp = OPENSSL_strdup(value);
1822.       if (!stmp)
1823.           return -1;

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)

apps/apps.c:1822:10: Taking false branch
1820.       char *stmp, *vtmp = NULL;
1821.       stmp = OPENSSL_strdup(value);
1822.       if (!stmp)
                 ^
1823.           return -1;
1824.       vtmp = strchr(stmp, ':');

apps/apps.c:1824:5: 
1822.       if (!stmp)
1823.           return -1;
1824. >     vtmp = strchr(stmp, ':');
1825.       if (vtmp) {
1826.           *vtmp = 0;

apps/apps.c:1825:9: Taking false branch
1823.           return -1;
1824.       vtmp = strchr(stmp, ':');
1825.       if (vtmp) {
                ^
1826.           *vtmp = 0;
1827.           vtmp++;

apps/apps.c:1829:5: 
1827.           vtmp++;
1828.       }
1829. >     rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1830.       OPENSSL_free(stmp);
1831.       return rv;

crypto/evp/pmeth_lib.c:320:1: start of procedure EVP_PKEY_CTX_ctrl_str()
  318.   }
  319.   
  320. > int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx,
  321.                             const char *name, const char *value)
  322.   {

crypto/evp/pmeth_lib.c:323:10: Taking false branch
  321.                             const char *name, const char *value)
  322.   {
  323.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                  ^
  324.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  325.           return -2;

crypto/evp/pmeth_lib.c:323:18: Taking false branch
  321.                             const char *name, const char *value)
  322.   {
  323.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                          ^
  324.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  325.           return -2;

crypto/evp/pmeth_lib.c:323:33: Taking false branch
  321.                             const char *name, const char *value)
  322.   {
  323.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                                         ^
  324.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  325.           return -2;

crypto/evp/pmeth_lib.c:327:9: Taking false branch
  325.           return -2;
  326.       }
  327.       if (strcmp(name, "digest") == 0) {
                 ^
  328.           const EVP_MD *md;
  329.           if (value == NULL || (md = EVP_get_digestbyname(value)) == NULL) {

crypto/evp/pmeth_lib.c:335:5: Skipping __function_pointer__(): unresolved function pointer
  333.           return EVP_PKEY_CTX_set_signature_md(ctx, md);
  334.       }
  335.       return ctx->pmeth->ctrl_str(ctx, name, value);
             ^
  336.   }
  337.   

crypto/evp/pmeth_lib.c:336:1: return from a call to EVP_PKEY_CTX_ctrl_str
  334.       }
  335.       return ctx->pmeth->ctrl_str(ctx, name, value);
  336. > }
  337.   
  338.   /* Utility functions to send a string of hex string to a ctrl */

apps/apps.c:1830:5: 
1828.       }
1829.       rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1830. >     OPENSSL_free(stmp);
1831.       return rv;
1832.   }

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 true 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:165:30: Taking true 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:166:9: Skipping __function_pointer__(): unresolved function pointer
  164.   {
  165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  166.           free_impl(str, file, line);
                 ^
  167.           return;
  168.       }

crypto/mem.c:167:9: 
  165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  166.           free_impl(str, file, line);
  167. >         return;
  168.       }
  169.   

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)

int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
{
    int rv;
    char *stmp, *vtmp = NULL;
    stmp = OPENSSL_strdup(value);
    if (!stmp)
        return -1;
    vtmp = strchr(stmp, ':');
    if (vtmp) {
        *vtmp = 0;
        vtmp++;
    }
    rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
    OPENSSL_free(stmp);
    return rv;
}
["int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)\n{\n    int rv;\n    char *stmp, *vtmp = NULL;\n    stmp = OPENSSL_strdup(value);\n    if (!stmp)\n        return -1;\n    vtmp = strchr(stmp, ':');\n    if (vtmp) {\n        *vtmp = 0;\n        vtmp++;\n    }\n    rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);\n    OPENSSL_free(stmp);\n    return rv;\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}', 'int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx,\n                          const char *name, const char *value)\n{\n    if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {\n        EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);\n        return -2;\n    }\n    if (strcmp(name, "digest") == 0) {\n        const EVP_MD *md;\n        if (value == NULL || (md = EVP_get_digestbyname(value)) == NULL) {\n            EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_INVALID_DIGEST);\n            return 0;\n        }\n        return EVP_PKEY_CTX_set_signature_md(ctx, md);\n    }\n    return ctx->pmeth->ctrl_str(ctx, name, value);\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}']