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


crypto/err/err.c:937:1: start of procedure ERR_add_error_vdata()
935.   }
936.   
937. > void ERR_add_error_vdata(int num, va_list args)
938.   {
939.       int i, n, s;

crypto/err/err.c:942:5: 
940.       char *str, *p, *a;
941.   
942. >     s = 80;
943.       str = OPENSSL_malloc(s + 1);
944.       if (str == NULL)

crypto/err/err.c:943:5: 
941.   
942.       s = 80;
943. >     str = OPENSSL_malloc(s + 1);
944.       if (str == NULL)
945.           return;

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

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

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

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

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

crypto/err/err.c:944:9: Taking false branch
942.       s = 80;
943.       str = OPENSSL_malloc(s + 1);
944.       if (str == NULL)
               ^
945.           return;
946.       str[0] = '\0';

crypto/err/err.c:946:5: 
944.       if (str == NULL)
945.           return;
946. >     str[0] = '\0';
947.   
948.       n = 0;

crypto/err/err.c:948:5: 
946.       str[0] = '\0';
947.   
948. >     n = 0;
949.       for (i = 0; i < num; i++) {
950.           a = va_arg(args, char *);

crypto/err/err.c:949:10: 
947.   
948.       n = 0;
949. >     for (i = 0; i < num; i++) {
950.           a = va_arg(args, char *);
951.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */

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

crypto/err/err.c:950:9: 
948.       n = 0;
949.       for (i = 0; i < num; i++) {
950. >         a = va_arg(args, char *);
951.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
952.           if (a != NULL) {

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

crypto/err/err.c:953:13: 
951.           /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
952.           if (a != NULL) {
953. >             n += strlen(a);
954.               if (n > s) {
955.                   s = n + 20;

crypto/err/err.c:954:17: Taking true branch
952.           if (a != NULL) {
953.               n += strlen(a);
954.               if (n > s) {
                       ^
955.                   s = n + 20;
956.                   p = OPENSSL_realloc(str, s + 1);

crypto/err/err.c:955:17: 
953.               n += strlen(a);
954.               if (n > s) {
955. >                 s = n + 20;
956.                   p = OPENSSL_realloc(str, s + 1);
957.                   if (p == NULL) {

crypto/err/err.c:956:17: 
954.               if (n > s) {
955.                   s = n + 20;
956. >                 p = OPENSSL_realloc(str, s + 1);
957.                   if (p == NULL) {
958.                       OPENSSL_free(str);

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

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

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

crypto/mem.c:171:9: Skipping __function_pointer__(): unresolved function pointer
  169.   {
  170.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
  171.           return realloc_impl(str, num, file, line);
                 ^
  172.   
  173.       if (str == NULL)

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

crypto/err/err.c:957:21: Taking true branch
955.                   s = n + 20;
956.                   p = OPENSSL_realloc(str, s + 1);
957.                   if (p == NULL) {
                           ^
958.                       OPENSSL_free(str);
959.                       return;

crypto/err/err.c:958:21: 
956.                   p = OPENSSL_realloc(str, s + 1);
957.                   if (p == NULL) {
958. >                     OPENSSL_free(str);
959.                       return;
960.                   }

crypto/mem.c:225:1: start of procedure CRYPTO_free()
  223.   }
  224.   
  225. > void CRYPTO_free(void *str, const char *file, int line)
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:227:9: Taking true branch
  225.   void CRYPTO_free(void *str, const char *file, int line)
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  228.           free_impl(str, file, line);
  229.           return;

crypto/mem.c:227:30: Taking true branch
  225.   void CRYPTO_free(void *str, const char *file, int line)
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                      ^
  228.           free_impl(str, file, line);
  229.           return;

crypto/mem.c:228:9: Skipping __function_pointer__(): unresolved function pointer
  226.   {
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  228.           free_impl(str, file, line);
                 ^
  229.           return;
  230.       }

crypto/mem.c:229:9: 
  227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  228.           free_impl(str, file, line);
  229. >         return;
  230.       }
  231.   

crypto/mem.c:243:1: return from a call to CRYPTO_free
  241.       free(str);
  242.   #endif
  243. > }
  244.   
  245.   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    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 (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    (void)file;\n    (void)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}']