summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9f19d00)
raw | patch | inline | side by side (parent: 9f19d00)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 4 Jun 2016 15:58:23 +0000 (17:58 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 4 Jun 2016 16:30:49 +0000 (18:30 +0200) |
Else, we'll leak any memory used by the regex.
src/utils_vl_lookup.c | patch | blob | history |
diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c
index a0237841eb43a7aebea172bed7246cd71f0e0bea..8a2e5671110f196e9ba72166303d9fbd436826b9 100644 (file)
--- a/src/utils_vl_lookup.c
+++ b/src/utils_vl_lookup.c
obj->cb_free_class (user_class_list->entry.user_class);
user_class_list->entry.user_class = NULL;
+#define CLEAR_FIELD(field) do { \
+ if (user_class_list->entry.match.field.is_regex) { \
+ regfree (&user_class_list->entry.match.field.regex); \
+ user_class_list->entry.match.field.is_regex = 0; \
+ } \
+} while (0)
+
+ CLEAR_FIELD (host);
+ CLEAR_FIELD (plugin);
+ CLEAR_FIELD (plugin_instance);
+ CLEAR_FIELD (type);
+ CLEAR_FIELD (type_instance);
+
+#undef CLEAR_FIELD
+
lu_destroy_user_obj (obj, user_class_list->entry.user_obj_list);
user_class_list->entry.user_obj_list = NULL;
pthread_mutex_destroy (&user_class_list->entry.lock);