summaryrefslogtreecommitdiffstats
path: root/web/attachments/364105-check_http_memory_leak.patch
blob: 49a35b8ba61d1d59abd802d341c1fbe1c0442d87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 0a4b12b..5cdf144 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)) {