crypto/ui/ui_lib.c:165: error: MEMORY_LEAK
  memory dynamically allocated by call to `general_allocate_prompt()` at line 157, column 20 is not reachable after line 165, column 13.
Showing all 61 steps of the trace


crypto/ui/ui_lib.c:150:1: start of procedure general_allocate_string()
148.   }
149.   
150. > static int general_allocate_string(UI *ui, const char *prompt,
151.                                      int prompt_freeable,
152.                                      enum UI_string_types type, int input_flags,

crypto/ui/ui_lib.c:156:5: 
154.                                      const char *test_buf)
155.   {
156. >     int ret = -1;
157.       UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
158.                                              type, input_flags, result_buf);

crypto/ui/ui_lib.c:157:5: 
155.   {
156.       int ret = -1;
157. >     UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
158.                                              type, input_flags, result_buf);
159.   

crypto/ui/ui_lib.c:128:1: start of procedure general_allocate_prompt()
  126.   }
  127.   
  128. > static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt,
  129.                                             int prompt_freeable,
  130.                                             enum UI_string_types type,

crypto/ui/ui_lib.c:133:5: 
  131.                                             int input_flags, char *result_buf)
  132.   {
  133. >     UI_STRING *ret = NULL;
  134.   
  135.       if (prompt == NULL) {

crypto/ui/ui_lib.c:135:9: Taking false branch
  133.       UI_STRING *ret = NULL;
  134.   
  135.       if (prompt == NULL) {
                 ^
  136.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, ERR_R_PASSED_NULL_PARAMETER);
  137.       } else if ((type == UIT_PROMPT || type == UIT_VERIFY

crypto/ui/ui_lib.c:137:17: Taking false branch
  135.       if (prompt == NULL) {
  136.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, ERR_R_PASSED_NULL_PARAMETER);
  137.       } else if ((type == UIT_PROMPT || type == UIT_VERIFY
                         ^
  138.                   || type == UIT_BOOLEAN) && result_buf == NULL) {
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);

crypto/ui/ui_lib.c:137:39: Taking false branch
  135.       if (prompt == NULL) {
  136.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, ERR_R_PASSED_NULL_PARAMETER);
  137.       } else if ((type == UIT_PROMPT || type == UIT_VERIFY
                                               ^
  138.                   || type == UIT_BOOLEAN) && result_buf == NULL) {
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);

crypto/ui/ui_lib.c:138:20: Taking true branch
  136.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, ERR_R_PASSED_NULL_PARAMETER);
  137.       } else if ((type == UIT_PROMPT || type == UIT_VERIFY
  138.                   || type == UIT_BOOLEAN) && result_buf == NULL) {
                            ^
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);
  140.       } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {

crypto/ui/ui_lib.c:138:44: Taking false branch
  136.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, ERR_R_PASSED_NULL_PARAMETER);
  137.       } else if ((type == UIT_PROMPT || type == UIT_VERIFY
  138.                   || type == UIT_BOOLEAN) && result_buf == NULL) {
                                                    ^
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);
  140.       } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {

crypto/ui/ui_lib.c:140:16: 
  138.                   || type == UIT_BOOLEAN) && result_buf == NULL) {
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);
  140. >     } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {
  141.           ret->out_string = prompt;
  142.           ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;

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 (num <= 0)

crypto/mem.c:123:9: Taking false branch
    121.       void *ret = NULL;
    122.   
    123.       if (num <= 0)
                   ^
    124.           return NULL;
    125.   

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

crypto/mem.c:136:5: 
    134.       }
    135.   #else
    136. >     (void)file;
    137.       (void)line;
    138.       ret = malloc(num);

crypto/mem.c:137:5: 
    135.   #else
    136.       (void)file;
    137. >     (void)line;
    138.       ret = malloc(num);
    139.   #endif

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

crypto/mem.c:153:5: 
    151.   #endif
    152.   
    153. >     return ret;
    154.   }
    155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
    152.   
    153.       return ret;
    154. > }
    155.   
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/ui/ui_lib.c:140:16: Taking true branch
  138.                   || type == UIT_BOOLEAN) && result_buf == NULL) {
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);
  140.       } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {
                        ^
  141.           ret->out_string = prompt;
  142.           ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;

crypto/ui/ui_lib.c:141:9: 
  139.           UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);
  140.       } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {
  141. >         ret->out_string = prompt;
  142.           ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
  143.           ret->input_flags = input_flags;

crypto/ui/ui_lib.c:142:22: Condition is true
  140.       } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {
  141.           ret->out_string = prompt;
  142.           ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
                              ^
  143.           ret->input_flags = input_flags;
  144.           ret->type = type;

crypto/ui/ui_lib.c:142:9: 
  140.       } else if ((ret = OPENSSL_malloc(sizeof(*ret))) != NULL) {
  141.           ret->out_string = prompt;
  142. >         ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
  143.           ret->input_flags = input_flags;
  144.           ret->type = type;

crypto/ui/ui_lib.c:143:9: 
  141.           ret->out_string = prompt;
  142.           ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
  143. >         ret->input_flags = input_flags;
  144.           ret->type = type;
  145.           ret->result_buf = result_buf;

crypto/ui/ui_lib.c:144:9: 
  142.           ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
  143.           ret->input_flags = input_flags;
  144. >         ret->type = type;
  145.           ret->result_buf = result_buf;
  146.       }

crypto/ui/ui_lib.c:145:9: 
  143.           ret->input_flags = input_flags;
  144.           ret->type = type;
  145. >         ret->result_buf = result_buf;
  146.       }
  147.       return ret;

crypto/ui/ui_lib.c:147:5: 
  145.           ret->result_buf = result_buf;
  146.       }
  147. >     return ret;
  148.   }
  149.   

crypto/ui/ui_lib.c:148:1: return from a call to general_allocate_prompt
  146.       }
  147.       return ret;
  148. > }
  149.   
  150.   static int general_allocate_string(UI *ui, const char *prompt,

crypto/ui/ui_lib.c:160:9: Taking true branch
158.                                              type, input_flags, result_buf);
159.   
160.       if (s) {
               ^
161.           if (allocate_string_stack(ui) >= 0) {
162.               s->_.string_data.result_minsize = minsize;

crypto/ui/ui_lib.c:161:13: 
159.   
160.       if (s) {
161. >         if (allocate_string_stack(ui) >= 0) {
162.               s->_.string_data.result_minsize = minsize;
163.               s->_.string_data.result_maxsize = maxsize;

crypto/ui/ui_lib.c:117:1: start of procedure allocate_string_stack()
  115.   }
  116.   
  117. > static int allocate_string_stack(UI *ui)
  118.   {
  119.       if (ui->strings == NULL) {

crypto/ui/ui_lib.c:119:9: Taking false branch
  117.   static int allocate_string_stack(UI *ui)
  118.   {
  119.       if (ui->strings == NULL) {
                 ^
  120.           ui->strings = sk_UI_STRING_new_null();
  121.           if (ui->strings == NULL) {

crypto/ui/ui_lib.c:125:5: 
  123.           }
  124.       }
  125. >     return 0;
  126.   }
  127.   

crypto/ui/ui_lib.c:126:1: return from a call to allocate_string_stack
  124.       }
  125.       return 0;
  126. > }
  127.   
  128.   static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt,

crypto/ui/ui_lib.c:161:13: Taking true branch
159.   
160.       if (s) {
161.           if (allocate_string_stack(ui) >= 0) {
                   ^
162.               s->_.string_data.result_minsize = minsize;
163.               s->_.string_data.result_maxsize = maxsize;

crypto/ui/ui_lib.c:162:13: 
160.       if (s) {
161.           if (allocate_string_stack(ui) >= 0) {
162. >             s->_.string_data.result_minsize = minsize;
163.               s->_.string_data.result_maxsize = maxsize;
164.               s->_.string_data.test_buf = test_buf;

crypto/ui/ui_lib.c:163:13: 
161.           if (allocate_string_stack(ui) >= 0) {
162.               s->_.string_data.result_minsize = minsize;
163. >             s->_.string_data.result_maxsize = maxsize;
164.               s->_.string_data.test_buf = test_buf;
165.               ret = sk_UI_STRING_push(ui->strings, s);

crypto/ui/ui_lib.c:164:13: 
162.               s->_.string_data.result_minsize = minsize;
163.               s->_.string_data.result_maxsize = maxsize;
164. >             s->_.string_data.test_buf = test_buf;
165.               ret = sk_UI_STRING_push(ui->strings, s);
166.               /* sk_push() returns 0 on error.  Let's adapt that */

crypto/ui/ui_lib.c:165:13: 
163.               s->_.string_data.result_maxsize = maxsize;
164.               s->_.string_data.test_buf = test_buf;
165. >             ret = sk_UI_STRING_push(ui->strings, s);
166.               /* sk_push() returns 0 on error.  Let's adapt that */
167.               if (ret <= 0)

include/openssl/ui.h:306:1: start of procedure sk_UI_STRING_push()
  304.    */
  305.   typedef struct ui_string_st UI_STRING;
  306. > DEFINE_STACK_OF(UI_STRING)
  307.   
  308.   /*

crypto/stack/stack.c:258:1: start of procedure sk_push()
    256.   }
    257.   
    258. > int sk_push(_STACK *st, void *data)
    259.   {
    260.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:260:5: 
    258.   int sk_push(_STACK *st, void *data)
    259.   {
    260. >     return (sk_insert(st, data, st->num));
    261.   }
    262.   

crypto/stack/stack.c:166:1: start of procedure sk_insert()
      164.   }
      165.   
      166. > int sk_insert(_STACK *st, void *data, int loc)
      167.   {
      168.       char **s;

crypto/stack/stack.c:170:9: Taking false branch
      168.       char **s;
      169.   
      170.       if (st == NULL)
                     ^
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {

crypto/stack/stack.c:172:9: Taking true branch
      170.       if (st == NULL)
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {
                     ^
      173.           s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);

crypto/stack/stack.c:173:9: 
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {
      173. >         s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      175.           if (s == NULL)

crypto/mem.c:165:1: start of procedure CRYPTO_realloc()
        163.   }
        164.   
        165. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
        166.   {
        167.       if (str == NULL)

crypto/mem.c:167:9: Taking true branch
        165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
        166.   {
        167.       if (str == NULL)
                       ^
        168.           return CRYPTO_malloc(num, file, line);
        169.   

crypto/mem.c:168:9: 
        166.   {
        167.       if (str == NULL)
        168. >         return CRYPTO_malloc(num, file, line);
        169.   
        170.       if (num == 0) {

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 (num <= 0)

crypto/mem.c:123:9: Taking true branch
          121.       void *ret = NULL;
          122.   
          123.       if (num <= 0)
                         ^
          124.           return NULL;
          125.   

crypto/mem.c:124:9: 
          122.   
          123.       if (num <= 0)
          124. >         return NULL;
          125.   
          126.       allow_customize = 0;

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
          152.   
          153.       return ret;
          154. > }
          155.   
          156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:190:1: return from a call to CRYPTO_realloc
        188.       return realloc(str, num);
        189.   
        190. > }
        191.   
        192.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/stack/stack.c:175:13: Taking true branch
      173.           s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      175.           if (s == NULL)
                         ^
      176.               return (0);
      177.           st->data = s;

crypto/stack/stack.c:176:13: 
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      175.           if (s == NULL)
      176. >             return (0);
      177.           st->data = s;
      178.           st->num_alloc *= 2;

crypto/stack/stack.c:190:1: return from a call to sk_insert
      188.       st->sorted = 0;
      189.       return (st->num);
      190. > }
      191.   
      192.   void *sk_delete_ptr(_STACK *st, void *p)

crypto/stack/stack.c:261:1: return from a call to sk_push
    259.   {
    260.       return (sk_insert(st, data, st->num));
    261. > }
    262.   
    263.   int sk_unshift(_STACK *st, void *data)

include/openssl/ui.h:306:1: return from a call to sk_UI_STRING_push
  304.    */
  305.   typedef struct ui_string_st UI_STRING;
  306. > DEFINE_STACK_OF(UI_STRING)
  307.   
  308.   /*
