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


apps/apps.c:1861:1: start of procedure pkey_ctrl_string()
1859.   }
1860.   
1861. > int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
1862.   {
1863.       int rv;

apps/apps.c:1864:5: 
1862.   {
1863.       int rv;
1864. >     char *stmp, *vtmp = NULL;
1865.       stmp = OPENSSL_strdup(value);
1866.       if (!stmp)

apps/apps.c:1865:5: 
1863.       int rv;
1864.       char *stmp, *vtmp = NULL;
1865. >     stmp = OPENSSL_strdup(value);
1866.       if (!stmp)
1867.           return -1;

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:166:1: start of procedure CRYPTO_malloc()
    164.   #endif
    165.   
    166. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    167.   {
    168.       void *ret = NULL;

crypto/mem.c:168:5: 
    166.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    167.   {
    168. >     void *ret = NULL;
    169.   
    170.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:170:9: Taking false branch
    168.       void *ret = NULL;
    169.   
    170.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    171.           return malloc_impl(num, file, line);
    172.   

crypto/mem.c:173:9: Taking false branch
    171.           return malloc_impl(num, file, line);
    172.   
    173.       if (num == 0)
                   ^
    174.           return NULL;
    175.   

crypto/mem.c:177:5: 
    175.   
    176.       FAILTEST();
    177. >     allow_customize = 0;
    178.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    179.       if (call_malloc_debug) {

crypto/mem.c:187:5: 
    185.       }
    186.   #else
    187. >     osslargused(file); osslargused(line);
    188.       ret = malloc(num);
    189.   #endif

crypto/mem.c:187:24: 
    185.       }
    186.   #else
    187. >     osslargused(file); osslargused(line);
    188.       ret = malloc(num);
    189.   #endif

crypto/mem.c:188:5: 
    186.   #else
    187.       osslargused(file); osslargused(line);
    188. >     ret = malloc(num);
    189.   #endif
    190.   

crypto/mem.c:191:5: 
    189.   #endif
    190.   
    191. >     return ret;
    192.   }
    193.   

crypto/mem.c:192:1: return from a call to CRYPTO_malloc
    190.   
    191.       return ret;
    192. > }
    193.   
    194.   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)

apps/apps.c:1866:10: Taking false branch
1864.       char *stmp, *vtmp = NULL;
1865.       stmp = OPENSSL_strdup(value);
1866.       if (!stmp)
                 ^
1867.           return -1;
1868.       vtmp = strchr(stmp, ':');

apps/apps.c:1868:5: 
1866.       if (!stmp)
1867.           return -1;
1868. >     vtmp = strchr(stmp, ':');
1869.       if (vtmp) {
1870.           *vtmp = 0;

apps/apps.c:1869:9: Taking false branch
1867.           return -1;
1868.       vtmp = strchr(stmp, ':');
1869.       if (vtmp) {
                ^
1870.           *vtmp = 0;
1871.           vtmp++;

apps/apps.c:1873:5: 
1871.           vtmp++;
1872.       }
1873. >     rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1874.       OPENSSL_free(stmp);
1875.       return rv;

crypto/evp/pmeth_lib.c:337:1: start of procedure EVP_PKEY_CTX_ctrl_str()
  335.   }
  336.   
  337. > int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx,
  338.                             const char *name, const char *value)
  339.   {

crypto/evp/pmeth_lib.c:340:10: Taking false branch
  338.                             const char *name, const char *value)
  339.   {
  340.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                  ^
  341.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  342.           return -2;

crypto/evp/pmeth_lib.c:340:18: Taking false branch
  338.                             const char *name, const char *value)
  339.   {
  340.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                          ^
  341.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  342.           return -2;

crypto/evp/pmeth_lib.c:340:33: Taking false branch
  338.                             const char *name, const char *value)
  339.   {
  340.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                                         ^
  341.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  342.           return -2;

crypto/evp/pmeth_lib.c:344:9: Taking false branch
  342.           return -2;
  343.       }
  344.       if (strcmp(name, "digest") == 0)
                 ^
  345.           return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD,
  346.                                  value);

crypto/evp/pmeth_lib.c:347:5: Skipping __function_pointer__(): unresolved function pointer
  345.           return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD,
  346.                                  value);
  347.       return ctx->pmeth->ctrl_str(ctx, name, value);
             ^
  348.   }
  349.   

crypto/evp/pmeth_lib.c:348:1: return from a call to EVP_PKEY_CTX_ctrl_str
  346.                                  value);
  347.       return ctx->pmeth->ctrl_str(ctx, name, value);
  348. > }
  349.   
  350.   /* Utility functions to send a string of hex string to a ctrl */

apps/apps.c:1874:5: 
1872.       }
1873.       rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1874. >     OPENSSL_free(stmp);
1875.       return rv;
1876.   }

crypto/mem.c:261:1: start of procedure CRYPTO_free()
  259.   }
  260.   
  261. > void CRYPTO_free(void *str, const char *file, int line)
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:263:9: Taking true branch
  261.   void CRYPTO_free(void *str, const char *file, int line)
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  264.           free_impl(str, file, line);
  265.           return;

crypto/mem.c:263:30: Taking true branch
  261.   void CRYPTO_free(void *str, const char *file, int line)
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                      ^
  264.           free_impl(str, file, line);
  265.           return;

crypto/mem.c:264:9: Skipping __function_pointer__(): unresolved function pointer
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  264.           free_impl(str, file, line);
                 ^
  265.           return;
  266.       }

crypto/mem.c:265:9: 
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  264.           free_impl(str, file, line);
  265. >         return;
  266.       }
  267.   

crypto/mem.c:279:1: return from a call to CRYPTO_free
  277.       free(str);
  278.   #endif
  279. > }
  280.   
  281.   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    FAILTEST();\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        return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD,\n                               value);\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}']