lkml.org 
[lkml]   [2012]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/7] parse-events: Fix a possible memory leak
Date
If event_read_fields failed in the middle, each member of
struct format_field should be freed also.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
parse-events.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/parse-events.c b/parse-events.c
index 773c928..710a9e8 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -1431,8 +1431,11 @@ static int event_read_fields(struct event_format *event, struct format_field **f
fail:
free_token(token);
fail_expect:
- if (field)
+ if (field) {
+ free(field->type);
+ free(field->name);
free(field);
+ }
return -1;
}

--
1.7.7.6


\
 
 \ /
  Last update: 2012-04-09 04:57    [from the cache]
©2003-2011 Jasper Spaans