Code

write_http plugin: Fixed a memory leak in the "StoreRates" code.
authorSebastian Harl <sh@tokkee.org>
Tue, 16 Feb 2010 22:54:02 +0000 (23:54 +0100)
committerSebastian Harl <sh@tokkee.org>
Thu, 25 Feb 2010 23:21:37 +0000 (00:21 +0100)
src/write_http.c

index 62e3cf3be067d0cb391ae798f734247cce621cc0..a7aafec888037589dd0218203e1677784553d50a 100644 (file)
@@ -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 */