From: Sebastian Harl Date: Tue, 16 Feb 2010 22:54:02 +0000 (+0100) Subject: write_http plugin: Fixed a memory leak in the "StoreRates" code. X-Git-Tag: collectd-4.10.0~60 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=80440c3c336e528063a6690317987fec5cbfda80;p=collectd.git write_http plugin: Fixed a memory leak in the "StoreRates" code. --- diff --git a/src/write_http.c b/src/write_http.c index 62e3cf3b..a7aafec8 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -288,9 +288,15 @@ static int wh_value_list_to_string (char *buffer, /* {{{ */ status = ssnprintf (buffer + offset, buffer_size - offset, \ __VA_ARGS__); \ if (status < 1) \ + { \ + sfree (rates); \ return (-1); \ + } \ else if (((size_t) status) >= (buffer_size - offset)) \ + { \ + sfree (rates); \ return (-1); \ + } \ else \ offset += ((size_t) status); \ } while (0) @@ -332,6 +338,7 @@ static int wh_value_list_to_string (char *buffer, /* {{{ */ #undef BUFFER_ADD +sfree (rates); return (0); } /* }}} int wh_value_list_to_string */