aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-02-22 18:56:35 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-02-22 18:56:35 -0500
commitbd5759228f1c4f9ed8f0312749c99ff6356fe843 (patch)
tree56d5a7116f02e6afa05b865aad0baf1083d2a3ad
parent2523a0115966e362175ecc355d3d495fd25edc8d (diff)
parse-events: Free comm in add_new_comm()
When the comm sent into add_new_comm() is not a match, we exit. What should be done is to free the comm first otherwise we leak memory. Found once again by valgrind. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/parse-events.c b/parse-events.c
index 215d2f5..8e79723 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -250,6 +250,7 @@ static int add_new_comm(struct pevent *pevent, char *comm, int pid)
250 sizeof(*pevent->cmdlines), cmdline_cmp); 250 sizeof(*pevent->cmdlines), cmdline_cmp);
251 if (cmdline) { 251 if (cmdline) {
252 errno = EEXIST; 252 errno = EEXIST;
253 free(comm);
253 return -1; 254 return -1;
254 } 255 }
255 256