[collectd] [PATCH] configfile.c: Fixed a memory leak in cf_read_generic().

Sebastian Harl sh at tokkee.org
Thu Mar 20 11:01:18 CET 2008


In case stat(2) failed, the memory allocated for the return value has not
been freed.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/configfile.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/configfile.c b/src/configfile.c
index 18c82d9..ef997fa 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -617,6 +617,7 @@ static oconfig_item_t *cf_read_generic (const char *path, int depth)
 			ERROR ("configfile: stat (%s) failed: %s",
 					path_ptr,
 					sstrerror (errno, errbuf, sizeof (errbuf)));
+			oconfig_free (root);
 			return (NULL);
 		}
 
-- 
1.5.4.3.325.g6d216

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080320/320ab81a/attachment.pgp 


More information about the collectd mailing list