crypto/err/err.c:767: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 752, column 11 is not reachable after line 767, column 21.
Showing all 37 steps of the trace


crypto/err/err.c:746:1: start of procedure ERR_add_error_vdata()
744.   }
745.   
746. > void ERR_add_error_vdata(int num, va_list args)
747.   {
748.       int i, n, s;

crypto/err/err.c:751:5: 
749.       char *str, *p, *a;
750.   
751. >     s = 80;
752.       str = OPENSSL_malloc(s + 1);
753.       if (str == NULL)

crypto/err/err.c:752:5: 
750.   
751.       s = 80;
752. >     str = OPENSSL_malloc(s + 1);
753.       if (str == NULL)
754.           return;

crypto/mem.c:166:1: start of procedure CRYPTO_malloc()
  164.   #endif
  165.   
  166. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  167.   {
  168.       void *ret = NULL;

crypto/mem.c:168:5: 
  166.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  167.   {
  168. >     void *ret = NULL;
  169.   
  170.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:170:9: Taking false branch
  168.       void *ret = NULL;
  169.   
  170.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  171.           return malloc_impl(num, file, line);
  172.   

crypto/mem.c:173:9: Taking false branch
  171.           return malloc_impl(num, file, line);
  172.   
  173.       if (num == 0)
                 ^
  174.           return NULL;
  175.   

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

crypto/mem.c:187:5: 
  185.       }
  186.   #else
  187. >     osslargused(file); osslargused(line);
  188.       ret = malloc(num);
  189.   #endif

crypto/mem.c:187:24: 
  185.       }
  186.   #else
  187. >     osslargused(file); osslargused(line);
  188.       ret = malloc(num);
  189.   #endif

crypto/mem.c:188:5: 
  186.   #else
  187.       osslargused(file); osslargused(line);
  188. >     ret = malloc(num);
  189.   #endif
  190.   

crypto/mem.c:191:5: 
  189.   #endif
  190.   
  191. >     return ret;
  192.   }
  193.   

crypto/mem.c:192:1: return from a call to CRYPTO_malloc
  190.   
  191.       return ret;
  192. > }
  193.   
  194.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/err/err.c:753:9: Taking false branch
751.       s = 80;
752.       str = OPENSSL_malloc(s + 1);
753.       if (str == NULL)
               ^
754.           return;
755.       str[0] = '\0';

crypto/err/err.c:755:5: 
753.       if (str == NULL)
754.           return;
755. >     str[0] = '\0';
756.   
757.       n = 0;

crypto/err/err.c:757:5: 
755.       str[0] = '\0';
756.   
757. >     n = 0;
758.       for (i = 0; i < num; i++) {
759.           a = va_arg(args, char *);

crypto/err/err.c:758:10: 
756.   
757.       n = 0;
758. >     for (i = 0; i < num; i++) {
759.           a = va_arg(args, char *);
760.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */

crypto/err/err.c:758:17: Loop condition is true. Entering loop body
756.   
757.       n = 0;
758.       for (i = 0; i < num; i++) {
                       ^
759.           a = va_arg(args, char *);
760.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */

crypto/err/err.c:759:9: 
757.       n = 0;
758.       for (i = 0; i < num; i++) {
759. >         a = va_arg(args, char *);
760.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
761.           if (a != NULL) {

crypto/err/err.c:761:13: Taking true branch
759.           a = va_arg(args, char *);
760.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
761.           if (a != NULL) {
                   ^
762.               n += strlen(a);
763.               if (n > s) {

crypto/err/err.c:762:13: 
760.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
761.           if (a != NULL) {
762. >             n += strlen(a);
763.               if (n > s) {
764.                   s = n + 20;

crypto/err/err.c:763:17: Taking true branch
761.           if (a != NULL) {
762.               n += strlen(a);
763.               if (n > s) {
                       ^
764.                   s = n + 20;
765.                   p = OPENSSL_realloc(str, s + 1);

crypto/err/err.c:764:17: 
762.               n += strlen(a);
763.               if (n > s) {
764. >                 s = n + 20;
765.                   p = OPENSSL_realloc(str, s + 1);
766.                   if (p == NULL) {

crypto/err/err.c:765:17: 
763.               if (n > s) {
764.                   s = n + 20;
765. >                 p = OPENSSL_realloc(str, s + 1);
766.                   if (p == NULL) {
767.                       OPENSSL_free(str);

crypto/mem.c:204:1: start of procedure CRYPTO_realloc()
  202.   }
  203.   
  204. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
  205.   {
  206.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)

crypto/mem.c:206:9: Taking true branch
  204.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
  205.   {
  206.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
                 ^
  207.           return realloc_impl(str, num, file, line);
  208.   

crypto/mem.c:206:33: Taking true branch
  204.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
  205.   {
  206.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
                                         ^
  207.           return realloc_impl(str, num, file, line);
  208.   

crypto/mem.c:207:9: Skipping __function_pointer__(): unresolved function pointer
  205.   {
  206.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
  207.           return realloc_impl(str, num, file, line);
                 ^
  208.   
  209.       FAILTEST();

crypto/mem.c:232:1: return from a call to CRYPTO_realloc
  230.       return realloc(str, num);
  231.   
  232. > }
  233.   
  234.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/err/err.c:766:21: Taking true branch
764.                   s = n + 20;
765.                   p = OPENSSL_realloc(str, s + 1);
766.                   if (p == NULL) {
                           ^
767.                       OPENSSL_free(str);
768.                       return;

crypto/err/err.c:767:21: 
765.                   p = OPENSSL_realloc(str, s + 1);
766.                   if (p == NULL) {
767. >                     OPENSSL_free(str);
768.                       return;
769.                   }

crypto/mem.c:261:1: start of procedure CRYPTO_free()
  259.   }
  260.   
  261. > void CRYPTO_free(void *str, const char *file, int line)
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:263:9: Taking true branch
  261.   void CRYPTO_free(void *str, const char *file, int line)
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  264.           free_impl(str, file, line);
  265.           return;

crypto/mem.c:263:30: Taking true branch
  261.   void CRYPTO_free(void *str, const char *file, int line)
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                      ^
  264.           free_impl(str, file, line);
  265.           return;

crypto/mem.c:264:9: Skipping __function_pointer__(): unresolved function pointer
  262.   {
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  264.           free_impl(str, file, line);
                 ^
  265.           return;
  266.       }

crypto/mem.c:265:9: 
  263.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  264.           free_impl(str, file, line);
  265. >         return;
  266.       }
  267.   

crypto/mem.c:279:1: return from a call to CRYPTO_free
  277.       free(str);
  278.   #endif
  279. > }
  280.   
  281.   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;
    str = OPENSSL_malloc(s + 1);
    if (str == NULL)
        return;
    str[0] = '\0';
    n = 0;
    for (i = 0; i < num; i++) {
        a = va_arg(args, char *);
        if (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    str = OPENSSL_malloc(s + 1);\n    if (str == NULL)\n        return;\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            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    }\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    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    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    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    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    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}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\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}']