aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorGravatar Ton Voon <ton.voon@opsera.com> 2010-02-26 12:47:38 +0000
committerGravatar Ton Voon <ton.voon@opsera.com> 2010-02-26 12:47:38 +0000
commit6b782ebfd4832c1fe621556bcf894162b8caa8aa (patch)
tree90471da0eaccc701722cf8899114ddbfdc2e7ce8 /plugins/check_http.c
parent45e205f4a6cf38ff0f8ade027a7b6a6c7376a00c (diff)
downloadmonitoring-plugins-6b782ebfd4832c1fe621556bcf894162b8caa8aa.tar.gz
Fix memory leak in check_http for large pages (Jimmy Bergman - #2957455)
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c5
1 files changed, 4 insertions, 1 deletions
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)) {