fix error handling path.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Fri, 16 Dec 2011 18:17:50 +0000 (16:17 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Sat, 17 Dec 2011 21:43:11 +0000 (19:43 -0200)
libkmod/libkmod-index.c

index 7f0c092..f908d27 100644 (file)
@@ -775,9 +775,9 @@ struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
 
 fail:
        close(fd);
-fail_open:
-       if (idx->mm)
+       if (idx->mm != MAP_FAILED)
                munmap(idx->mm, st.st_size);
+fail_open:
        free(idx);
        return NULL;
 }