fix memory leak while managing custom variables
Costa Tsaousis (ktsaou) committed
Oct 15, 2017 at 22:06 UTC
14f3e7ef2ac40bb302f9ae16c02970a7008b0f4b
1 file changed
+4
-1
src/rrdvar.c
+4
-1
@@ -84,7 +84,8 @@ inline RRDVAR *rrdvar_create_and_index(const char *scope, avl_tree_lock *tree, c
84
RRDVAR *ret = rrdvar_index_add(tree, rv);
85
if(unlikely(ret != rv)) {
86
debug(D_VARIABLES, "Variable '%s' in scope '%s' already exists", variable, scope);
87
- rrdvar_free(NULL, NULL, rv);
87
+ freez(rv);
88
+ freez(variable);
89
rv = NULL;
90
}
91
else
@@ -124,6 +125,8 @@ RRDVAR *rrdvar_custom_host_variable_create(RRDHOST *host, const char *name) {
125
uint32_t hash = simple_hash(variable);
126
127
rv = rrdvar_index_find(&host->variables_root_index, variable, hash);
128
+
129
+ freez(variable);
130
}
131
132
return rv;