index_file_open: fix another fd leak on error path.
authorCristian Rodríguez <crrodriguez@opensuse.org>
Mon, 26 Dec 2011 04:38:04 +0000 (01:38 -0300)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Mon, 26 Dec 2011 11:55:15 +0000 (09:55 -0200)
libkmod/libkmod-index.c

index 9a0dd2a..580b059 100644 (file)
@@ -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;