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


apps/apps.c:1889:1: start of procedure pkey_ctrl_string()
1887.   }
1888.   
1889. > int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
1890.   {
1891.       int rv;

apps/apps.c:1892:5: 
1890.   {
1891.       int rv;
1892. >     char *stmp, *vtmp = NULL;
1893.       stmp = OPENSSL_strdup(value);
1894.       if (!stmp)

apps/apps.c:1893:5: 
1891.       int rv;
1892.       char *stmp, *vtmp = NULL;
1893. >     stmp = OPENSSL_strdup(value);
1894.       if (!stmp)
1895.           return -1;

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. >     (void)file;
    140.       (void)line;
    141.       ret = malloc(num);

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

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

crypto/mem.c:156:5: 
    154.   #endif
    155.   
    156. >     return ret;
    157.   }
    158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
    155.   
    156.       return ret;
    157. > }
    158.   
    159.   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)

apps/apps.c:1894:10: Taking false branch
1892.       char *stmp, *vtmp = NULL;
1893.       stmp = OPENSSL_strdup(value);
1894.       if (!stmp)
                 ^
1895.           return -1;
1896.       vtmp = strchr(stmp, ':');

apps/apps.c:1896:5: 
1894.       if (!stmp)
1895.           return -1;
1896. >     vtmp = strchr(stmp, ':');
1897.       if (vtmp) {
1898.           *vtmp = 0;

apps/apps.c:1897:9: Taking false branch
1895.           return -1;
1896.       vtmp = strchr(stmp, ':');
1897.       if (vtmp) {
                ^
1898.           *vtmp = 0;
1899.           vtmp++;

apps/apps.c:1901:5: 
1899.           vtmp++;
1900.       }
1901. >     rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1902.       OPENSSL_free(stmp);
1903.       return rv;

crypto/evp/pmeth_lib.c:372:1: start of procedure EVP_PKEY_CTX_ctrl_str()
  370.   }
  371.   
  372. > int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx,
  373.                             const char *name, const char *value)
  374.   {

crypto/evp/pmeth_lib.c:375:10: Taking false branch
  373.                             const char *name, const char *value)
  374.   {
  375.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                  ^
  376.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  377.           return -2;

crypto/evp/pmeth_lib.c:375:18: Taking false branch
  373.                             const char *name, const char *value)
  374.   {
  375.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                          ^
  376.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  377.           return -2;

crypto/evp/pmeth_lib.c:375:33: Taking false branch
  373.                             const char *name, const char *value)
  374.   {
  375.       if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
                                         ^
  376.           EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
  377.           return -2;

crypto/evp/pmeth_lib.c:379:9: Taking false branch
  377.           return -2;
  378.       }
  379.       if (strcmp(name, "digest") == 0) {
                 ^
  380.           const EVP_MD *md;
  381.           if (value == NULL || (md = EVP_get_digestbyname(value)) == NULL) {

crypto/evp/pmeth_lib.c:387:5: Skipping __function_pointer__(): unresolved function pointer
  385.           return EVP_PKEY_CTX_set_signature_md(ctx, md);
  386.       }
  387.       return ctx->pmeth->ctrl_str(ctx, name, value);
             ^
  388.   }
  389.   

crypto/evp/pmeth_lib.c:388:1: return from a call to EVP_PKEY_CTX_ctrl_str
  386.       }
  387.       return ctx->pmeth->ctrl_str(ctx, name, value);
  388. > }
  389.   
  390.   int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx)

apps/apps.c:1902:5: 
1900.       }
1901.       rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1902. >     OPENSSL_free(stmp);
1903.       return rv;
1904.   }

crypto/mem.c:225:1: start of procedure CRYPTO_free()
  223.   }
  224.   
  225. > void CRYPTO_free(void *str, const char *file, int line)
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:227:9: Taking true branch
  225.   void CRYPTO_free(void *str, const char *file, int line)
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  228.           free_impl(str, file, line);
  229.           return;

crypto/mem.c:227:30: Taking true branch
  225.   void CRYPTO_free(void *str, const char *file, int line)
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                      ^
  228.           free_impl(str, file, line);
  229.           return;

crypto/mem.c:228:9: Skipping __function_pointer__(): unresolved function pointer
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  228.           free_impl(str, file, line);
                 ^
  229.           return;
  230.       }

crypto/mem.c:229:9: 
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  228.           free_impl(str, file, line);
  229. >         return;
  230.       }
  231.   

crypto/mem.c:243:1: return from a call to CRYPTO_free
  241.       free(str);
  242.   #endif
  243. > }
  244.   
  245.   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    (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}', '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}']