From: Cristian Rodríguez Date: Fri, 23 Dec 2011 05:06:56 +0000 (-0200) Subject: Fix leak on error path X-Git-Tag: v3~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67d94ad38853b58f658f84e69d33145dfbff3721;p=thirdparty%2Fkmod.git Fix leak on error path --- diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index 2f6e7992..9a0dd2a1 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)