apps/engine.c:105: error: MEMORY_LEAK
  memory dynamically allocated by call to `app_malloc()` at line 99, column 16 is not reachable after line 105, column 9.
Showing all 30 steps of the trace


apps/engine.c:95:1: start of procedure append_buf()
93.   }
94.   
95. > static int append_buf(char **buf, const char *s, int *size, int step)
96.   {
97.       if (*buf == NULL) {

apps/engine.c:97:9: Taking true branch
95.   static int append_buf(char **buf, const char *s, int *size, int step)
96.   {
97.       if (*buf == NULL) {
               ^
98.           *size = step;
99.           *buf = app_malloc(*size, "engine buffer");

apps/engine.c:98:9: 
96.   {
97.       if (*buf == NULL) {
98. >         *size = step;
99.           *buf = app_malloc(*size, "engine buffer");
100.           **buf = '\0';

apps/engine.c:99:9: 
97.       if (*buf == NULL) {
98.           *size = step;
99. >         *buf = app_malloc(*size, "engine buffer");
100.           **buf = '\0';
101.       }

apps/apps.c:976:1: start of procedure app_malloc()
  974.   }
  975.   
  976. > void* app_malloc(int sz, const char *what)
  977.   {
  978.       void *vp = OPENSSL_malloc(sz);

apps/apps.c:978:5: 
  976.   void* app_malloc(int sz, const char *what)
  977.   {
  978. >     void *vp = OPENSSL_malloc(sz);
  979.   
  980.       if (vp == NULL) {

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
    118.   }
    119.   
    120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    121.   {
    122.       void *ret = NULL;

crypto/mem.c:122:5: 
    120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    121.   {
    122. >     void *ret = NULL;
    123.   
    124.       if (num <= 0)

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

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

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

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

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

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

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

apps/apps.c:980:9: Taking false branch
  978.       void *vp = OPENSSL_malloc(sz);
  979.   
  980.       if (vp == NULL) {
                 ^
  981.           BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n",
  982.                   opt_getprog(), sz, what);

apps/apps.c:986:5: 
  984.           exit(1);
  985.       }
  986. >     return vp;
  987.   }
  988.   

apps/apps.c:987:1: return from a call to app_malloc
  985.       }
  986.       return vp;
  987. > }
  988.   
  989.   

apps/engine.c:100:9: 
98.           *size = step;
99.           *buf = app_malloc(*size, "engine buffer");
100. >         **buf = '\0';
101.       }
102.   

apps/engine.c:103:9: Taking true branch
101.       }
102.   
103.       if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
               ^
104.           *size += step;
105.           *buf = OPENSSL_realloc(*buf, *size);

apps/engine.c:104:9: 
102.   
103.       if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
104. >         *size += step;
105.           *buf = OPENSSL_realloc(*buf, *size);
106.       }

apps/engine.c:105:9: 
103.       if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
104.           *size += step;
105. >         *buf = OPENSSL_realloc(*buf, *size);
106.       }
107.   

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

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

crypto/mem.c:171:9: Taking false branch
  169.           return CRYPTO_malloc(num, file, line);
  170.   
  171.       if (num == 0) {
                 ^
  172.           CRYPTO_free(str);
  173.           return NULL;

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

crypto/mem.c:186:5: 
  184.       }
  185.   #else
  186. >     (void)file;
  187.       (void)line;
  188.   #endif

crypto/mem.c:187:5: 
  185.   #else
  186.       (void)file;
  187. >     (void)line;
  188.   #endif
  189.       return realloc(str, num);

crypto/mem.c:189:5: 
  187.       (void)line;
  188.   #endif
  189. >     return realloc(str, num);
  190.   
  191.   }

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

static int append_buf(char **buf, const char *s, int *size, int step)
{
    if (*buf == NULL) {
        *size = step;
        *buf = app_malloc(*size, "engine buffer");
        **buf = '\0';
    }
    if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
        *size += step;
        *buf = OPENSSL_realloc(*buf, *size);
    }
    if (*buf == NULL)
        return 0;
    if (**buf != '\0')
        OPENSSL_strlcat(*buf, ", ", *size);
    OPENSSL_strlcat(*buf, s, *size);
    return 1;
}
['static int append_buf(char **buf, const char *s, int *size, int step)\n{\n    if (*buf == NULL) {\n        *size = step;\n        *buf = app_malloc(*size, "engine buffer");\n        **buf = \'\\0\';\n    }\n    if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {\n        *size += step;\n        *buf = OPENSSL_realloc(*buf, *size);\n    }\n    if (*buf == NULL)\n        return 0;\n    if (**buf != \'\\0\')\n        OPENSSL_strlcat(*buf, ", ", *size);\n    OPENSSL_strlcat(*buf, s, *size);\n    return 1;\n}', 'void* app_malloc(int sz, const char *what)\n{\n    void *vp = OPENSSL_malloc(sz);\n    if (vp == NULL) {\n        BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\\n",\n                opt_getprog(), sz, what);\n        ERR_print_errors(bio_err);\n        exit(1);\n    }\n    return vp;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\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}', 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)file;\n    (void)line;\n#endif\n    return realloc(str, num);\n}']