From: Alexey Gladkov Date: Sun, 14 Apr 2013 19:34:13 +0000 (+0400) Subject: analyze.l: Fix potential memory leak X-Git-Tag: 2.0.2~41^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d9a907f07ac0c1ab7ba23cabe298768a76ba546;p=platform%2Fupstream%2Fkbd.git analyze.l: Fix potential memory leak Signed-off-by: Alexey Gladkov --- diff --git a/src/libkeymap/analyze.l b/src/libkeymap/analyze.l index 92df059..7adffbc 100644 --- a/src/libkeymap/analyze.l +++ b/src/libkeymap/analyze.l @@ -114,7 +114,7 @@ static int find_incl_file_near_fn(struct keymap *kmap, char *s, char *fn, lkfile_t *fp) { const char *include_dirpath2[] = { 0, 0, 0, 0 }; - char *t, *te, *t1, *t2; + char *t, *te, *t1 = NULL, *t2 = NULL; int len, rc = 1; if (!fn) @@ -146,8 +146,10 @@ find_incl_file_near_fn(struct keymap *kmap, char *s, char *fn, lkfile_t *fp) free(t); return rc; - /* FIXME: free */ nomem: ERR(kmap, _("out of memory")); + if (t1) free(t1); + if (t2) free(t2); + if (t) free(t); return -1; }