crypto/ocsp/ocsp_ht.c:80: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 78, column 19 is not reachable after line 80, column 9.
Showing all 60 steps of the trace


crypto/ocsp/ocsp_ht.c:64:1: start of procedure OCSP_REQ_CTX_new()
62.   static int parse_http_line1(char *line);
63.   
64. > OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline)
65.   {
66.       OCSP_REQ_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));

crypto/ocsp/ocsp_ht.c:66:5: 
64.   OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline)
65.   {
66. >     OCSP_REQ_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));
67.   
68.       if (rctx == NULL)

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
  226.   }
  227.   
  228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
  228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230. >     void *ret = CRYPTO_malloc(num, file, line);
  231.   
  232.       FAILTEST();

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/mem.c:233:9: Taking true branch
  231.   
  232.       FAILTEST();
  233.       if (ret != NULL)
                 ^
  234.           memset(ret, 0, num);
  235.       return ret;

crypto/mem.c:234:9: 
  232.       FAILTEST();
  233.       if (ret != NULL)
  234. >         memset(ret, 0, num);
  235.       return ret;
  236.   }

crypto/mem.c:235:5: 
  233.       if (ret != NULL)
  234.           memset(ret, 0, num);
  235. >     return ret;
  236.   }
  237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
  234.           memset(ret, 0, num);
  235.       return ret;
  236. > }
  237.   
  238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/ocsp/ocsp_ht.c:68:9: Taking false branch
66.       OCSP_REQ_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));
67.   
68.       if (rctx == NULL)
              ^
69.           return NULL;
70.       rctx->state = OHS_ERROR;

crypto/ocsp/ocsp_ht.c:70:5: 
68.       if (rctx == NULL)
69.           return NULL;
70. >     rctx->state = OHS_ERROR;
71.       rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;
72.       rctx->mem = BIO_new(BIO_s_mem());

crypto/ocsp/ocsp_ht.c:71:5: 
69.           return NULL;
70.       rctx->state = OHS_ERROR;
71. >     rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;
72.       rctx->mem = BIO_new(BIO_s_mem());
73.       rctx->io = io;

crypto/ocsp/ocsp_ht.c:72:5: 
70.       rctx->state = OHS_ERROR;
71.       rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;
72. >     rctx->mem = BIO_new(BIO_s_mem());
73.       rctx->io = io;
74.       if (maxline > 0)

crypto/bio/bss_mem.c:71:1: start of procedure BIO_s_mem()
  69.    */
  70.   
  71. > const BIO_METHOD *BIO_s_mem(void)
  72.   {
  73.       return &mem_method;

crypto/bio/bss_mem.c:73:5: 
  71.   const BIO_METHOD *BIO_s_mem(void)
  72.   {
  73. >     return &mem_method;
  74.   }
  75.   

crypto/bio/bss_mem.c:74:1: return from a call to BIO_s_mem
  72.   {
  73.       return &mem_method;
  74. > }
  75.   
  76.   const BIO_METHOD *BIO_s_secmem(void)

crypto/ocsp/ocsp_ht.c:72:5: Skipping BIO_new(): empty list of specs
70.       rctx->state = OHS_ERROR;
71.       rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;
72.       rctx->mem = BIO_new(BIO_s_mem());
          ^
73.       rctx->io = io;
74.       if (maxline > 0)

crypto/ocsp/ocsp_ht.c:73:5: 
71.       rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;
72.       rctx->mem = BIO_new(BIO_s_mem());
73. >     rctx->io = io;
74.       if (maxline > 0)
75.           rctx->iobuflen = maxline;

crypto/ocsp/ocsp_ht.c:74:9: Taking true branch
72.       rctx->mem = BIO_new(BIO_s_mem());
73.       rctx->io = io;
74.       if (maxline > 0)
              ^
75.           rctx->iobuflen = maxline;
76.       else

crypto/ocsp/ocsp_ht.c:75:9: 
73.       rctx->io = io;
74.       if (maxline > 0)
75. >         rctx->iobuflen = maxline;
76.       else
77.           rctx->iobuflen = OCSP_MAX_LINE_LEN;

crypto/ocsp/ocsp_ht.c:78:5: 
76.       else
77.           rctx->iobuflen = OCSP_MAX_LINE_LEN;
78. >     rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
79.       if (rctx->iobuf == NULL || rctx->mem == NULL) {
80.           OCSP_REQ_CTX_free(rctx);

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 false branch
  202.   
  203.       FAILTEST();
  204.       if (allow_customize) {
                 ^
  205.           /*
  206.            * Disallow customization after the first allocation. We only set this

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/ocsp/ocsp_ht.c:79:9: Taking false branch
77.           rctx->iobuflen = OCSP_MAX_LINE_LEN;
78.       rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
79.       if (rctx->iobuf == NULL || rctx->mem == NULL) {
              ^
80.           OCSP_REQ_CTX_free(rctx);
81.           return NULL;

crypto/ocsp/ocsp_ht.c:79:32: Taking true branch
77.           rctx->iobuflen = OCSP_MAX_LINE_LEN;
78.       rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
79.       if (rctx->iobuf == NULL || rctx->mem == NULL) {
                                     ^
80.           OCSP_REQ_CTX_free(rctx);
81.           return NULL;

crypto/ocsp/ocsp_ht.c:80:9: 
78.       rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
79.       if (rctx->iobuf == NULL || rctx->mem == NULL) {
80. >         OCSP_REQ_CTX_free(rctx);
81.           return NULL;
82.       }

crypto/ocsp/ocsp_ht.c:86:1: start of procedure OCSP_REQ_CTX_free()
  84.   }
  85.   
  86. > void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
  87.   {
  88.       if (!rctx)

crypto/ocsp/ocsp_ht.c:88:10: Taking false branch
  86.   void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
  87.   {
  88.       if (!rctx)
                 ^
  89.           return;
  90.       BIO_free(rctx->mem);

crypto/ocsp/ocsp_ht.c:90:5: Skipping BIO_free(): empty list of specs
  88.       if (!rctx)
  89.           return;
  90.       BIO_free(rctx->mem);
            ^
  91.       OPENSSL_free(rctx->iobuf);
  92.       OPENSSL_free(rctx);

crypto/ocsp/ocsp_ht.c:91:5: 
  89.           return;
  90.       BIO_free(rctx->mem);
  91. >     OPENSSL_free(rctx->iobuf);
  92.       OPENSSL_free(rctx);
  93.   }

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)

crypto/ocsp/ocsp_ht.c:92:5: 
  90.       BIO_free(rctx->mem);
  91.       OPENSSL_free(rctx->iobuf);
  92. >     OPENSSL_free(rctx);
  93.   }
  94.   

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 false 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:312:5: 
    310.       }
    311.   #else
    312. >     free(str);
    313.   #endif
    314.   }

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)

crypto/ocsp/ocsp_ht.c:93:1: return from a call to OCSP_REQ_CTX_free
  91.       OPENSSL_free(rctx->iobuf);
  92.       OPENSSL_free(rctx);
  93. > }
  94.   
  95.   BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx)

OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline)
{
    OCSP_REQ_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));
    if (rctx == NULL)
        return NULL;
    rctx->state = OHS_ERROR;
    rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;
    rctx->mem = BIO_new(BIO_s_mem());
    rctx->io = io;
    if (maxline > 0)
        rctx->iobuflen = maxline;
    else
        rctx->iobuflen = OCSP_MAX_LINE_LEN;
    rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
    if (rctx->iobuf == NULL || rctx->mem == NULL) {
        OCSP_REQ_CTX_free(rctx);
        return NULL;
    }
    return rctx;
}
['OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline)\n{\n    OCSP_REQ_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));\n    if (rctx == NULL)\n        return NULL;\n    rctx->state = OHS_ERROR;\n    rctx->max_resp_len = OCSP_MAX_RESP_LENGTH;\n    rctx->mem = BIO_new(BIO_s_mem());\n    rctx->io = io;\n    if (maxline > 0)\n        rctx->iobuflen = maxline;\n    else\n        rctx->iobuflen = OCSP_MAX_LINE_LEN;\n    rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);\n    if (rctx->iobuf == NULL || rctx->mem == NULL) {\n        OCSP_REQ_CTX_free(rctx);\n        return NULL;\n    }\n    return rctx;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\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}', 'const BIO_METHOD *BIO_s_mem(void)\n{\n    return &mem_method;\n}', 'void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)\n{\n    if (!rctx)\n        return;\n    BIO_free(rctx->mem);\n    OPENSSL_free(rctx->iobuf);\n    OPENSSL_free(rctx);\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}']