summaryrefslogtreecommitdiff
path: root/libkmod/libkmod-index.c
diff options
context:
space:
mode:
authorCristian Rodríguez <crrodriguez@opensuse.org>2011-12-26 01:38:04 -0300
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2011-12-26 09:55:15 -0200
commit4088b27e2138271fc84df3e02faf6e23a7c89458 (patch)
treec444870e3c0d972751a03d4d35482200ff8ce08f /libkmod/libkmod-index.c
parentef4a349aaa4fb6f8111144a9b1c96d652bdb3581 (diff)
downloadkmod-4088b27e2138271fc84df3e02faf6e23a7c89458.tar.gz
kmod-4088b27e2138271fc84df3e02faf6e23a7c89458.tar.bz2
kmod-4088b27e2138271fc84df3e02faf6e23a7c89458.zip
index_file_open: fix another fd leak on error path.
Diffstat (limited to 'libkmod/libkmod-index.c')
-rw-r--r--libkmod/libkmod-index.c4
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;