crypto/ui/ui_lib.c:246: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_strdup()` at line 239, column 23 is not reachable after line 246, column 5.
Showing all 30 steps of the trace


crypto/ui/ui_lib.c:232:1: start of procedure UI_dup_verify_string()
230.   }
231.   
232. > int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
233.                            char *result_buf, int minsize, int maxsize,
234.                            const char *test_buf)

crypto/ui/ui_lib.c:236:5: 
234.                            const char *test_buf)
235.   {
236. >     char *prompt_copy = NULL;
237.   
238.       if (prompt) {

crypto/ui/ui_lib.c:238:9: Taking true branch
236.       char *prompt_copy = NULL;
237.   
238.       if (prompt) {
               ^
239.           prompt_copy = OPENSSL_strdup(prompt);
240.           if (prompt_copy == NULL) {

crypto/ui/ui_lib.c:239:9: 
237.   
238.       if (prompt) {
239. >         prompt_copy = OPENSSL_strdup(prompt);
240.           if (prompt_copy == NULL) {
241.               UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);

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: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: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)

crypto/ui/ui_lib.c:240:13: Taking false branch
238.       if (prompt) {
239.           prompt_copy = OPENSSL_strdup(prompt);
240.           if (prompt_copy == NULL) {
                   ^
241.               UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
242.               return -1;

crypto/ui/ui_lib.c:246:5: 
244.       }
245.   
246. >     return general_allocate_string(ui, prompt_copy, 1,
247.                                      UIT_VERIFY, flags, result_buf, minsize,
248.                                      maxsize, test_buf);

crypto/ui/ui_lib.c:117:1: start of procedure general_allocate_string()
  115.   }
  116.   
  117. > static int general_allocate_string(UI *ui, const char *prompt,
  118.                                      int prompt_freeable,
  119.                                      enum UI_string_types type, int input_flags,

crypto/ui/ui_lib.c:123:5: 
  121.                                      const char *test_buf)
  122.   {
  123. >     int ret = -1;
  124.       UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
  125.                                              type, input_flags, result_buf);

crypto/ui/ui_lib.c:124:5: Skipping general_allocate_prompt(): empty list of specs
  122.   {
  123.       int ret = -1;
  124.       UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
             ^
  125.                                              type, input_flags, result_buf);
  126.   

crypto/ui/ui_lib.c:127:9: Taking false branch
  125.                                              type, input_flags, result_buf);
  126.   
  127.       if (s) {
                 ^
  128.           if (allocate_string_stack(ui) >= 0) {
  129.               s->_.string_data.result_minsize = minsize;

crypto/ui/ui_lib.c:141:5: 
  139.               free_string(s);
  140.       }
  141. >     return ret;
  142.   }
  143.   

crypto/ui/ui_lib.c:142:1: return from a call to general_allocate_string
  140.       }
  141.       return ret;
  142. > }
  143.   
  144.   static int general_allocate_boolean(UI *ui,

int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
                         char *result_buf, int minsize, int maxsize,
                         const char *test_buf)
{
    char *prompt_copy = NULL;
    if (prompt) {
        prompt_copy = OPENSSL_strdup(prompt);
        if (prompt_copy == NULL) {
            UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
            return -1;
        }
    }
    return general_allocate_string(ui, prompt_copy, 1,
                                   UIT_VERIFY, flags, result_buf, minsize,
                                   maxsize, test_buf);
}
['int UI_dup_verify_string(UI *ui, const char *prompt, int flags,\n                         char *result_buf, int minsize, int maxsize,\n                         const char *test_buf)\n{\n    char *prompt_copy = NULL;\n    if (prompt) {\n        prompt_copy = OPENSSL_strdup(prompt);\n        if (prompt_copy == NULL) {\n            UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);\n            return -1;\n        }\n    }\n    return general_allocate_string(ui, prompt_copy, 1,\n                                   UIT_VERIFY, flags, result_buf, minsize,\n                                   maxsize, test_buf);\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}', 'static int general_allocate_string(UI *ui, const char *prompt,\n                                   int prompt_freeable,\n                                   enum UI_string_types type, int input_flags,\n                                   char *result_buf, int minsize, int maxsize,\n                                   const char *test_buf)\n{\n    int ret = -1;\n    UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,\n                                           type, input_flags, result_buf);\n    if (s) {\n        if (allocate_string_stack(ui) >= 0) {\n            s->_.string_data.result_minsize = minsize;\n            s->_.string_data.result_maxsize = maxsize;\n            s->_.string_data.test_buf = test_buf;\n            ret = sk_UI_STRING_push(ui->strings, s);\n            if (ret <= 0) {\n                ret--;\n                free_string(s);\n            }\n        } else\n            free_string(s);\n    }\n    return ret;\n}']