From: Cristian Rodríguez Date: Mon, 26 Dec 2011 04:38:04 +0000 (-0300) Subject: index_file_open: fix another fd leak on error path. X-Git-Tag: v3~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4088b27e2138271fc84df3e02faf6e23a7c89458;p=thirdparty%2Fkmod.git index_file_open: fix another fd leak on error path. --- diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index 9a0dd2a1..580b0599 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -348,8 +348,10 @@ struct index_file *index_file_open(const char *filename) } version = read_long(file); - if (version >> 16 != INDEX_VERSION_MAJOR) + if (version >> 16 != INDEX_VERSION_MAJOR) { + fclose(file); return NULL; + } new = NOFAIL(malloc(sizeof(struct index_file))); new->file = file;