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


apps/engine.c:101:1: start of procedure append_buf()
99.   }
100.   
101. > static int append_buf(char **buf, int *size, const char *s)
102.   {
103.       if (*buf == NULL) {

apps/engine.c:103:9: Taking true branch
101.   static int append_buf(char **buf, int *size, const char *s)
102.   {
103.       if (*buf == NULL) {
               ^
104.           *size = 256;
105.           *buf = app_malloc(*size, "engine buffer");

apps/engine.c:104:9: 
102.   {
103.       if (*buf == NULL) {
104. >         *size = 256;
105.           *buf = app_malloc(*size, "engine buffer");
106.           **buf = '\0';

apps/engine.c:105:9: 
103.       if (*buf == NULL) {
104.           *size = 256;
105. >         *buf = app_malloc(*size, "engine buffer");
106.           **buf = '\0';
107.       }

apps/apps.c:987:1: start of procedure app_malloc()
  985.   }
  986.   
  987. > void* app_malloc(int sz, const char *what)
  988.   {
  989.       void *vp = OPENSSL_malloc(sz);

apps/apps.c:989:5: 
  987.   void* app_malloc(int sz, const char *what)
  988.   {
  989. >     void *vp = OPENSSL_malloc(sz);
  990.   
  991.       if (vp == NULL) {

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

crypto/mem.c:139:24: 
    137.       }
    138.   #else
    139. >     osslargused(file); osslargused(line);
    140.       ret = malloc(num);
    141.   #endif

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

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

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

apps/apps.c:991:9: Taking false branch
  989.       void *vp = OPENSSL_malloc(sz);
  990.   
  991.       if (vp == NULL) {
                 ^
  992.           BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n",
  993.                   opt_getprog(), sz, what);

apps/apps.c:997:5: 
  995.           exit(1);
  996.       }
  997. >     return vp;
  998.   }
  999.   

apps/apps.c:998:1: return from a call to app_malloc
  996.       }
  997.       return vp;
  998. > }
  999.   
  1000.   /*

apps/engine.c:106:9: 
104.           *size = 256;
105.           *buf = app_malloc(*size, "engine buffer");
106. >         **buf = '\0';
107.       }
108.   

apps/engine.c:109:9: Taking true branch
107.       }
108.   
109.       if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
               ^
110.           *size += 256;
111.           *buf = OPENSSL_realloc(*buf, *size);

apps/engine.c:110:9: 
108.   
109.       if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
110. >         *size += 256;
111.           *buf = OPENSSL_realloc(*buf, *size);
112.       }

apps/engine.c:111:9: 
109.       if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
110.           *size += 256;
111. >         *buf = OPENSSL_realloc(*buf, *size);
112.       }
113.   

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

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

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

crypto/mem.c:175:9: Taking false branch
  173.           return CRYPTO_malloc(num, file, line);
  174.   
  175.       if (num == 0) {
                 ^
  176.           CRYPTO_free(str, file, line);
  177.           return NULL;

crypto/mem.c:180:5: 
  178.       }
  179.   
  180. >     allow_customize = 0;
  181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  182.       if (call_malloc_debug) {

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

crypto/mem.c:190:24: 
  188.       }
  189.   #else
  190. >     osslargused(file); osslargused(line);
  191.   #endif
  192.       return realloc(str, num);

crypto/mem.c:192:5: 
  190.       osslargused(file); osslargused(line);
  191.   #endif
  192. >     return realloc(str, num);
  193.   
  194.   }

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

static int append_buf(char **buf, int *size, const char *s)
{
    if (*buf == NULL) {
        *size = 256;
        *buf = app_malloc(*size, "engine buffer");
        **buf = '\0';
    }
    if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
        *size += 256;
        *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, int *size, const char *s)\n{\n    if (*buf == NULL) {\n        *size = 256;\n        *buf = app_malloc(*size, "engine buffer");\n        **buf = \'\\0\';\n    }\n    if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {\n        *size += 256;\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 (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#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 (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)\n        return realloc_impl(str, num, file, line);\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str, file, line);\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    osslargused(file); osslargused(line);\n#endif\n    return realloc(str, num);\n}']