summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0c62bc4)
raw | patch | inline | side by side (parent: 0c62bc4)
author | Florian Forster <octo@collectd.org> | |
Fri, 19 Jun 2015 05:05:22 +0000 (07:05 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 19 Jun 2015 05:11:04 +0000 (07:11 +0200) |
* Free "times" pointer if it is not returned to the user.
* Free (re)alloc'ed pointers when strdup() fails.
* Free (re)alloc'ed pointers when strdup() fails.
src/utils_cache.c | patch | blob | history |
diff --git a/src/utils_cache.c b/src/utils_cache.c
index e77f9942c8ffe5273f55744e53a2513e5df22a77..dc0ff0df27b33f21d5f3701c2d18648ae35a8ce6 100644 (file)
--- a/src/utils_cache.c
+++ b/src/utils_cache.c
pthread_mutex_unlock (&cache_lock);
if (keys_len == 0)
+ {
+ /* realloc() may have been called for these. */
+ sfree (keys);
+ sfree (keys_time);
+ sfree (keys_interval);
return (0);
+ }
/* Call the "missing" callback for each value. Do this before removing the
* value from the cache, so that callbacks can still access the data stored,
*ret_names = names;
if (ret_times != NULL)
*ret_times = times;
+ else
+ sfree (times);
*ret_number = number;
return (0);