Message ID | 20240607160542.46152-4-jmarchan@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | c84155f7dfedeb0e0c0c00f5fae7bad67f494de7 |
Headers | show |
Series | libtraceevent: fix misc issues found by static analysis | expand |
diff --git a/src/event-plugin.c b/src/event-plugin.c index 7f94107..c944204 100644 --- a/src/event-plugin.c +++ b/src/event-plugin.c @@ -327,7 +327,7 @@ int tep_plugin_add_option(const char *name, const char *val) return -ENOMEM; if (parse_option_name(&option_str, &plugin) < 0) - return -ENOMEM; + goto out_free; /* If the option exists, update the val */ for (op = trace_plugin_options; op; op = op->next) {
If parse_option_name() fails, plugin, which now points to the previous value of option_str isn't freed. Go to out_free if that happen. Fixes a RESOURCE_LEAK error (CWE-772) Signed-off-by: Jerome Marchand <jmarchan@redhat.com> --- src/event-plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)