perf tools: Fix potential memory leak in perf events parser
Subsystems (3)
Quoted 2 lines
Fix potential memory leak in function
parse_events_term__sym_hw()andparse_events_term__clone().
Would you like to add the tag “Fixes” to the commit message?
…
Quoted 1 line
+++
b/tools/perf/util/parse-events.c
…
Quoted 11 lines
(quoted diff) +4
-2@@ -2957,9 +2958,20 @@ int parse_events_term__sym_hw(struct parse_events_term **term, sym = &event_symbols_hw[idx]; str = strdup(sym->symbol); - if (!str) + if (!str) { + if (!config) + free(temp.config); return -ENOMEM; - return new_term(term, &temp, str, 0); + }
Review int parse_events_term__sym_hw(struct parse_events_term **term, · line 2975
Quoted 10 lines
(quoted diff) +9
-0+ + ret = new_term(term, &temp, str, 0); + if (ret < 0) { + free(str); + if (!config) + free(temp.config); + } + + return ret; }
…
How do you think about to add jump targets for a bit of common exception handling code in these function implementations?
Regards,
Markus
Quoted 32 lines · Markus Elfring
Quoted 2 lines
Fix potential memory leak in function
parse_events_term__sym_hw()andparse_events_term__clone().Would you like to add the tag “Fixes” to the commit message?
…
Quoted 1 line
+++
b/tools/perf/util/parse-events.c…
Quoted 21 lines
(quoted diff) +13
-2@@ -2957,9 +2958,20 @@ int parse_events_term__sym_hw(struct parse_events_term **term, sym = &event_symbols_hw[idx]; str = strdup(sym->symbol); - if (!str) + if (!str) { + if (!config) + free(temp.config); return -ENOMEM; - return new_term(term, &temp, str, 0); + } + + ret = new_term(term, &temp, str, 0); + if (ret < 0) { + free(str); + if (!config) + free(temp.config); + } + + return ret; }…
Quoted 2 lines
How do you think about to add jump targets for a bit of common exception handling code in these function implementations?
Hi,
This is the semi-friendly patch-bot of Greg Kroah-Hartman.
Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.
Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them.
thanks,
greg k-h's patch email bot