crypto/err/err.c:868: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 852, column 16 is not reachable after line 868, column 17.
Showing all 38 steps of the trace


crypto/err/err.c:846:1: start of procedure ERR_add_error_vdata()
844.   }
845.   
846. > void ERR_add_error_vdata(int num, va_list args)
847.   {
848.       int i, n, s;

crypto/err/err.c:851:5: 
849.       char *str, *p, *a;
850.   
851. >     s = 80;
852.       if ((str = OPENSSL_malloc(s + 1)) == NULL) {
853.           /* ERRerr(ERR_F_ERR_ADD_ERROR_VDATA, ERR_R_MALLOC_FAILURE); */

crypto/err/err.c:852:9: 
850.   
851.       s = 80;
852. >     if ((str = OPENSSL_malloc(s + 1)) == NULL) {
853.           /* ERRerr(ERR_F_ERR_ADD_ERROR_VDATA, ERR_R_MALLOC_FAILURE); */
854.           return;

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
  190.   #endif
  191.   
  192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  193.   {
  194.       void *ret = NULL;

crypto/mem.c:194:5: 
  192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  193.   {
  194. >     void *ret = NULL;
  195.   
  196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
  195.   
  196.       INCREMENT(malloc_count);
  197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  198.           return malloc_impl(num, file, line);
  199.   

crypto/mem.c:200:9: Taking false branch
  198.           return malloc_impl(num, file, line);
  199.   
  200.       if (num == 0)
                 ^
  201.           return NULL;
  202.   

crypto/mem.c:204:9: Taking true branch
  202.   
  203.       FAILTEST();
  204.       if (allow_customize) {
                 ^
  205.           /*
  206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
  208.            * allocation.
  209.            */
  210. >         allow_customize = 0;
  211.       }
  212.   #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)

crypto/mem.c:221:5: 
  219.       }
  220.   #else
  221. >     (void)(file); (void)(line);
  222.       ret = malloc(num);
  223.   #endif

crypto/mem.c:221:19: 
  219.       }
  220.   #else
  221. >     (void)(file); (void)(line);
  222.       ret = malloc(num);
  223.   #endif

crypto/mem.c:222:5: 
  220.   #else
  221.       (void)(file); (void)(line);
  222. >     ret = malloc(num);
  223.   #endif
  224.   

crypto/mem.c:225:5: 
  223.   #endif
  224.   
  225. >     return ret;
  226.   }
  227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
  224.   
  225.       return ret;
  226. > }
  227.   
  228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/err/err.c:852:9: Taking false branch
850.   
851.       s = 80;
852.       if ((str = OPENSSL_malloc(s + 1)) == NULL) {
               ^
853.           /* ERRerr(ERR_F_ERR_ADD_ERROR_VDATA, ERR_R_MALLOC_FAILURE); */
854.           return;

crypto/err/err.c:856:5: 
854.           return;
855.       }
856. >     str[0] = '\0';
857.   
858.       n = 0;

crypto/err/err.c:858:5: 
856.       str[0] = '\0';
857.   
858. >     n = 0;
859.       for (i = 0; i < num; i++) {
860.           a = va_arg(args, char *);

crypto/err/err.c:859:10: 
857.   
858.       n = 0;
859. >     for (i = 0; i < num; i++) {
860.           a = va_arg(args, char *);
861.           if (a == NULL)

crypto/err/err.c:859:17: Loop condition is true. Entering loop body
857.   
858.       n = 0;
859.       for (i = 0; i < num; i++) {
                       ^
860.           a = va_arg(args, char *);
861.           if (a == NULL)

crypto/err/err.c:860:9: 
858.       n = 0;
859.       for (i = 0; i < num; i++) {
860. >         a = va_arg(args, char *);
861.           if (a == NULL)
862.               a = "<NULL>";

crypto/err/err.c:861:13: Taking false branch
859.       for (i = 0; i < num; i++) {
860.           a = va_arg(args, char *);
861.           if (a == NULL)
                   ^
862.               a = "<NULL>";
863.           n += strlen(a);

crypto/err/err.c:863:9: 
861.           if (a == NULL)
862.               a = "<NULL>";
863. >         n += strlen(a);
864.           if (n > s) {
865.               s = n + 20;

crypto/err/err.c:864:13: Taking true branch
862.               a = "<NULL>";
863.           n += strlen(a);
864.           if (n > s) {
                   ^
865.               s = n + 20;
866.               p = OPENSSL_realloc(str, s + 1);

crypto/err/err.c:865:13: 
863.           n += strlen(a);
864.           if (n > s) {
865. >             s = n + 20;
866.               p = OPENSSL_realloc(str, s + 1);
867.               if (p == NULL) {

crypto/err/err.c:866:13: 
864.           if (n > s) {
865.               s = n + 20;
866. >             p = OPENSSL_realloc(str, s + 1);
867.               if (p == NULL) {
868.                   OPENSSL_free(str);

crypto/mem.c:238:1: start of procedure CRYPTO_realloc()
  236.   }
  237.   
  238. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
  239.   {
  240.       INCREMENT(realloc_count);

crypto/mem.c:241:9: Taking true branch
  239.   {
  240.       INCREMENT(realloc_count);
  241.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
                 ^
  242.           return realloc_impl(str, num, file, line);
  243.   

crypto/mem.c:241:33: Taking true branch
  239.   {
  240.       INCREMENT(realloc_count);
  241.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
                                         ^
  242.           return realloc_impl(str, num, file, line);
  243.   

crypto/mem.c:242:9: Skipping __function_pointer__(): unresolved function pointer
  240.       INCREMENT(realloc_count);
  241.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
  242.           return realloc_impl(str, num, file, line);
                 ^
  243.   
  244.       FAILTEST();

crypto/mem.c:266:1: return from a call to CRYPTO_realloc
  264.       return realloc(str, num);
  265.   
  266. > }
  267.   
  268.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/err/err.c:867:17: Taking true branch
865.               s = n + 20;
866.               p = OPENSSL_realloc(str, s + 1);
867.               if (p == NULL) {
                       ^
868.                   OPENSSL_free(str);
869.                   return;

crypto/err/err.c:868:17: 
866.               p = OPENSSL_realloc(str, s + 1);
867.               if (p == NULL) {
868. >                 OPENSSL_free(str);
869.                   return;
870.               }

crypto/mem.c:295:1: start of procedure CRYPTO_free()
  293.   }
  294.   
  295. > void CRYPTO_free(void *str, const char *file, int line)
  296.   {
  297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
  296.   {
  297.       INCREMENT(free_count);
  298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  299.           free_impl(str, file, line);
  300.           return;

crypto/mem.c:298:30: Taking true branch
  296.   {
  297.       INCREMENT(free_count);
  298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                      ^
  299.           free_impl(str, file, line);
  300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
  297.       INCREMENT(free_count);
  298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  299.           free_impl(str, file, line);
                 ^
  300.           return;
  301.       }

crypto/mem.c:300:9: 
  298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  299.           free_impl(str, file, line);
  300. >         return;
  301.       }
  302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
  312.       free(str);
  313.   #endif
  314. > }
  315.   
  316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

void ERR_add_error_vdata(int num, va_list args)
{
    int i, n, s;
    char *str, *p, *a;
    s = 80;
    if ((str = OPENSSL_malloc(s + 1)) == NULL) {
        return;
    }
    str[0] = '\0';
    n = 0;
    for (i = 0; i < num; i++) {
        a = va_arg(args, char *);
        if (a == NULL)
            a = "<NULL>";
        n += strlen(a);
        if (n > s) {
            s = n + 20;
            p = OPENSSL_realloc(str, s + 1);
            if (p == NULL) {
                OPENSSL_free(str);
                return;
            }
            str = p;
        }
        OPENSSL_strlcat(str, a, (size_t)s + 1);
    }
    if (!err_set_error_data_int(str, ERR_TXT_MALLOCED | ERR_TXT_STRING))
        OPENSSL_free(str);
}
['void ERR_add_error_vdata(int num, va_list args)\n{\n    int i, n, s;\n    char *str, *p, *a;\n    s = 80;\n    if ((str = OPENSSL_malloc(s + 1)) == NULL) {\n        return;\n    }\n    str[0] = \'\\0\';\n    n = 0;\n    for (i = 0; i < num; i++) {\n        a = va_arg(args, char *);\n        if (a == NULL)\n            a = "<NULL>";\n        n += strlen(a);\n        if (n > s) {\n            s = n + 20;\n            p = OPENSSL_realloc(str, s + 1);\n            if (p == NULL) {\n                OPENSSL_free(str);\n                return;\n            }\n            str = p;\n        }\n        OPENSSL_strlcat(str, a, (size_t)s + 1);\n    }\n    if (!err_set_error_data_int(str, ERR_TXT_MALLOCED | ERR_TXT_STRING))\n        OPENSSL_free(str);\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)\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); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    INCREMENT(realloc_count);\n    if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)\n        return realloc_impl(str, num, file, line);\n    FAILTEST();\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#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)\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); (void)(line);\n#endif\n    return realloc(str, num);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    INCREMENT(free_count);\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)\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}']