[PATCH] index_file_open: fix another fd leak on error path.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Cristian Rodríguez <crrodriguez@xxxxxxxxxxxx>
---
 libkmod/libkmod-index.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c
index 9a0dd2a..580b059 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;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux