From 6b782ebfd4832c1fe621556bcf894162b8caa8aa Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Fri, 26 Feb 2010 12:47:38 +0000 Subject: Fix memory leak in check_http for large pages (Jimmy Bergman - #2957455) --- plugins/check_http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/check_http.c b/plugins/check_http.c index 0a4b12bb..5cdf144b 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -784,6 +784,7 @@ check_http (void) int i = 0; size_t pagesize = 0; char *full_page; + char *full_page_new; char *buf; char *pos; long microsec; @@ -871,7 +872,9 @@ check_http (void) full_page = strdup(""); while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { buffer[i] = '\0'; - asprintf (&full_page, "%s%s", full_page, buffer); + asprintf (&full_page_new, "%s%s", full_page, buffer); + free (full_page); + full_page = full_page_new; pagesize += i; if (no_body && document_headers_done (full_page)) { -- cgit v1.2.3-74-g34f1