[PATCH] lib: fwts_keymap: free keymap_list on error
Colin King
colin.king at canonical.com
Mon May 6 21:59:09 UTC 2013
From: Colin Ian King <colin.king at canonical.com>
Coverity CID #997344, Resource leak.
Need to free keymap_list before we return
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_keymap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lib/src/fwts_keymap.c b/src/lib/src/fwts_keymap.c
index 71800fc..646cdfa 100644
--- a/src/lib/src/fwts_keymap.c
+++ b/src/lib/src/fwts_keymap.c
@@ -62,8 +62,10 @@ fwts_list *fwts_keymap_load(const char *machine)
snprintf(path, sizeof(path), "%s/%s", FWTS_KEYMAP_PATH, machine);
- if ((fp = fopen(path, "r")) == NULL)
+ if ((fp = fopen(path, "r")) == NULL) {
+ fwts_keymap_free(keymap_list);
return NULL;
+ }
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
fwts_keycode *key;
--
1.8.1.2
More information about the fwts-devel
mailing list