From 67d94ad38853b58f658f84e69d33145dfbff3721 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cristian=20Rodr=C3=ADguez?= Date: Fri, 23 Dec 2011 03:06:56 -0200 Subject: [PATCH] Fix leak on error path --- libkmod/libkmod-index.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index 2f6e799..9a0dd2a 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -342,8 +342,10 @@ struct index_file *index_file_open(const char *filename) errno = EINVAL; magic = read_long(file); - if (magic != INDEX_MAGIC) + if (magic != INDEX_MAGIC) { + fclose(file); return NULL; + } version = read_long(file); if (version >> 16 != INDEX_VERSION_MAJOR) -- 2.7.4