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


crypto/err/err.c:783:1: start of procedure ERR_add_error_vdata()
781.   }
782.   
783. > void ERR_add_error_vdata(int num, va_list args)
784.   {
785.       int i, n, s;

crypto/err/err.c:788:5: 
786.       char *str, *p, *a;
787.   
788. >     s = 80;
789.       if ((str = OPENSSL_malloc(s + 1)) == NULL) {
790.           /* ERRerr(ERR_F_ERR_ADD_ERROR_VDATA, ERR_R_MALLOC_FAILURE); */

crypto/err/err.c:789:9: 
787.   
788.       s = 80;
789. >     if ((str = OPENSSL_malloc(s + 1)) == NULL) {
790.           /* ERRerr(ERR_F_ERR_ADD_ERROR_VDATA, ERR_R_MALLOC_FAILURE); */
791.           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.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

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:789:9: Taking false branch
787.   
788.       s = 80;
789.       if ((str = OPENSSL_malloc(s + 1)) == NULL) {
               ^
790.           /* ERRerr(ERR_F_ERR_ADD_ERROR_VDATA, ERR_R_MALLOC_FAILURE); */
791.           return;

crypto/err/err.c:793:5: 
791.           return;
792.       }
793. >     str[0] = '\0';
794.   
795.       n = 0;

crypto/err/err.c:795:5: 
793.       str[0] = '\0';
794.   
795. >     n = 0;
796.       for (i = 0; i < num; i++) {
797.           a = va_arg(args, char *);

crypto/err/err.c:796:10: 
794.   
795.       n = 0;
796. >     for (i = 0; i < num; i++) {
797.           a = va_arg(args, char *);
798.           if (a == NULL)

crypto/err/err.c:796:17: Loop condition is true. Entering loop body
794.   
795.       n = 0;
796.       for (i = 0; i < num; i++) {
                       ^
797.           a = va_arg(args, char *);
798.           if (a == NULL)

crypto/err/err.c:797:9: 
795.       n = 0;
796.       for (i = 0; i < num; i++) {
797. >         a = va_arg(args, char *);
798.           if (a == NULL)
799.               a = "<NULL>";

crypto/err/err.c:798:13: Taking false branch
796.       for (i = 0; i < num; i++) {
797.           a = va_arg(args, char *);
798.           if (a == NULL)
                   ^
799.               a = "<NULL>";
800.           n += strlen(a);

crypto/err/err.c:800:9: 
798.           if (a == NULL)
799.               a = "<NULL>";
800. >         n += strlen(a);
801.           if (n > s) {
802.               s = n + 20;

crypto/err/err.c:801:13: Taking true branch
799.               a = "<NULL>";
800.           n += strlen(a);
801.           if (n > s) {
                   ^
802.               s = n + 20;
803.               p = OPENSSL_realloc(str, s + 1);

crypto/err/err.c:802:13: 
800.           n += strlen(a);
801.           if (n > s) {
802. >             s = n + 20;
803.               p = OPENSSL_realloc(str, s + 1);
804.               if (p == NULL) {

crypto/err/err.c:803:13: 
801.           if (n > s) {
802.               s = n + 20;
803. >             p = OPENSSL_realloc(str, s + 1);
804.               if (p == NULL) {
805.                   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:804:17: Taking true branch
802.               s = n + 20;
803.               p = OPENSSL_realloc(str, s + 1);
804.               if (p == NULL) {
                       ^
805.                   OPENSSL_free(str);
806.                   return;

crypto/err/err.c:805:17: 
803.               p = OPENSSL_realloc(str, s + 1);
804.               if (p == NULL) {
805. >                 OPENSSL_free(str);
806.                   return;
807.               }

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);
    }
    ERR_set_error_data(str, ERR_TXT_MALLOCED | ERR_TXT_STRING);
}
['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    ERR_set_error_data(str, ERR_TXT_MALLOCED | ERR_TXT_STRING);\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#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); (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#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); (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#ifndef OPENSSL_NO_CRYPTO_MDEBUG\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}']