From 4088b27e2138271fc84df3e02faf6e23a7c89458 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cristian=20Rodr=C3=ADguez?= Date: Mon, 26 Dec 2011 01:38:04 -0300 Subject: [PATCH] index_file_open: fix another fd 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 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; -- 2.47.2