From: Sebastian Harl Date: Mon, 26 Nov 2007 11:17:26 +0000 (+0100) Subject: perl plugin: Fixed a memory leak in pplugin_register_data_set(). X-Git-Tag: collectd-4.3.0beta0~77 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4c8dc8ef46b360f4586e21a81cc2cd6037deb34f;p=collectd.git perl plugin: Fixed a memory leak in pplugin_register_data_set(). The data set definition is copied by plugin_register_data_set() (in plugin.c) and thus should be freed after it has been passed on to the plugin module. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/src/perl.c b/src/perl.c index c0e99f5f..dc548b25 100644 --- a/src/perl.c +++ b/src/perl.c @@ -388,6 +388,7 @@ static char *get_module_name (char *buf, size_t buf_len, const char *module) { static int pplugin_register_data_set (pTHX_ char *name, AV *dataset) { int len = -1; + int ret = 0; int i = 0; data_source_t *ds = NULL; @@ -428,7 +429,12 @@ static int pplugin_register_data_set (pTHX_ char *name, AV *dataset) set->ds_num = len + 1; set->ds = ds; - return plugin_register_data_set (set); + + ret = plugin_register_data_set (set); + + free (ds); + free (set); + return ret; } /* static int pplugin_register_data_set (char *, SV *) */ /*