Collectd::Unixsock: Added license information.
[collectd.git] / src / perl.c
index c0e99f5..b87d6b7 100644 (file)
@@ -376,7 +376,7 @@ static char *get_module_name (char *buf, size_t buf_len, const char *module) {
                status = snprintf (buf, buf_len, "%s", module);
        else
                status = snprintf (buf, buf_len, "%s::%s", base_name, module);
-       if ((status < 0) || (status >= buf_len))
+       if ((status < 0) || ((unsigned int)status >= buf_len))
                return (NULL);
        buf[buf_len - 1] = '\0';
        return (buf);
@@ -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 *) */
 
 /*
@@ -1083,8 +1089,8 @@ static int g_iv_set (pTHX_ SV *var, MAGIC *mg)
        return 0;
 } /* static int g_iv_set (pTHX_ SV *, MAGIC *) */
 
-static MGVTBL g_pv_vtbl = { g_pv_get, g_pv_set, NULL, NULL, NULL };
-static MGVTBL g_iv_vtbl = { g_iv_get, g_iv_set, NULL, NULL, NULL };
+static MGVTBL g_pv_vtbl = { g_pv_get, g_pv_set, NULL, NULL, NULL, NULL, NULL };
+static MGVTBL g_iv_vtbl = { g_iv_get, g_iv_set, NULL, NULL, NULL, NULL, NULL };
 
 /* bootstrap the Collectd module */
 static void xs_init (pTHX)