Skip to contentSkip to conversation

libtracefs: Free the regex in update_filter()

PATCH New Steven Rostedt 1 participant 1 message May 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Free the regex in update_filter()

From: "Steven Rostedt (VMware)" <[email protected]>

A regex is used to match functions in update_filter() using the regcomp() functionality. But regcomp() needs to release its resources via regfree() which is lacking in this function.

Fixes 2df4a7ea ("libtracefs: Add checking of available_filter_functions to tracefs_function_filter()")
---
 src/tracefs-tools.c | 1 +
 1 file changed, 1 insertion(+)
src/tracefs-tools.c +1 -0
index 6ef17f6..993fb3c 100644
@@ -816,6 +816,7 @@ static int update_filter(const char *filter_path, int *fd,
 	}
 
  out_free:
+	regfree(&func_filter.re);
 	free_func_list(func_list);
  out:
 	pthread_mutex_unlock(lock);
Signature · 1 line
2.29.2