diff options
author | Ton Voon <ton.voon@opsera.com> | 2010-02-26 12:47:38 (GMT) |
---|---|---|
committer | Ton Voon <ton.voon@opsera.com> | 2010-02-26 12:47:38 (GMT) |
commit | 6b782ebfd4832c1fe621556bcf894162b8caa8aa (patch) | |
tree | 90471da0eaccc701722cf8899114ddbfdc2e7ce8 | |
parent | 45e205f4a6cf38ff0f8ade027a7b6a6c7376a00c (diff) | |
download | monitoring-plugins-6b782ebfd4832c1fe621556bcf894162b8caa8aa.tar.gz |
Fix memory leak in check_http for large pages (Jimmy Bergman - #2957455)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | plugins/check_http.c | 5 |
3 files changed, 6 insertions, 1 deletions
@@ -8,6 +8,7 @@ This file documents the major additions and syntax changes between releases. | |||
8 | check_icmp now increment the sequence counter in each packet | 8 | check_icmp now increment the sequence counter in each packet |
9 | Fix usage of repeated -o options in check_snmp | 9 | Fix usage of repeated -o options in check_snmp |
10 | Try to detect arguments passed via --with-ping[6]-command and set options accordingly (#2908236) | 10 | Try to detect arguments passed via --with-ping[6]-command and set options accordingly (#2908236) |
11 | Fix memory leak in check_http for large pages (Jimmy Bergman - #2957455) | ||
11 | WARNINGS | 12 | WARNINGS |
12 | Updated developer documentation to say that performance labels should not have an equals sign or | 13 | Updated developer documentation to say that performance labels should not have an equals sign or |
13 | single quote in the label | 14 | single quote in the label |
@@ -258,3 +258,4 @@ Nikita Kalabukhov | |||
258 | Grant Byers | 258 | Grant Byers |
259 | Marcel Kuiper | 259 | Marcel Kuiper |
260 | Bryan Irvine | 260 | Bryan Irvine |
261 | Jimmy Bergman | ||
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) | |||
784 | int i = 0; | 784 | int i = 0; |
785 | size_t pagesize = 0; | 785 | size_t pagesize = 0; |
786 | char *full_page; | 786 | char *full_page; |
787 | char *full_page_new; | ||
787 | char *buf; | 788 | char *buf; |
788 | char *pos; | 789 | char *pos; |
789 | long microsec; | 790 | long microsec; |
@@ -871,7 +872,9 @@ check_http (void) | |||
871 | full_page = strdup(""); | 872 | full_page = strdup(""); |
872 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | 873 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { |
873 | buffer[i] = '\0'; | 874 | buffer[i] = '\0'; |
874 | asprintf (&full_page, "%s%s", full_page, buffer); | 875 | asprintf (&full_page_new, "%s%s", full_page, buffer); |
876 | free (full_page); | ||
877 | full_page = full_page_new; | ||
875 | pagesize += i; | 878 | pagesize += i; |
876 | 879 | ||
877 | if (no_body && document_headers_done (full_page)) { | 880 | if (no_body && document_headers_done (full_page)) { |