From dea544b9d19403f3ee5f715c6438e27577feb6c1 Mon Sep 17 00:00:00 2001 From: stephenprocter Date: Tue, 21 Jan 2020 12:59:50 +0400 Subject: [PATCH] Problem: zhttp_response_recv leaks memory when result is non-zero Solution: Destroy the headers received from zhttp_client --- src/zhttp_response.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zhttp_response.c b/src/zhttp_response.c index 916436010..e00d3ff10 100644 --- a/src/zhttp_response.c +++ b/src/zhttp_response.c @@ -119,6 +119,7 @@ zhttp_response_recv (zhttp_response_t *self, zhttp_client_t *client, void** arg_ self->free_content = self->content != NULL; if (result != 0) { + zhash_destroy(&self->headers); self->headers = zhash_new (); zhash_autofree (self->headers); @@ -247,4 +248,4 @@ zhttp_response_reset_content (zhttp_response_t *self) { void zhttp_response_test (bool verbose) { -} \ No newline at end of file +}