]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib: [sysfs.c] fix double free
authorKarel Zak <kzak@redhat.com>
Fri, 27 May 2011 12:47:40 +0000 (14:47 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 30 May 2011 14:37:46 +0000 (16:37 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/sysfs.c

index 524c97f55778bd020807c8a8a3c2ac8807494aa2..b9ddc67f5e9eb835e681a611df1ddd2045cb9a13 100644 (file)
@@ -167,10 +167,12 @@ void sysfs_deinit(struct sysfs_cxt *cxt)
 
        if (cxt->dir_fd >= 0)
               close(cxt->dir_fd);
+       free(cxt->dir_path);
+
        cxt->devno = 0;
        cxt->dir_fd = -1;
        cxt->parent = NULL;
-       free(cxt->dir_path);
+       cxt->dir_path = NULL;
 }
 
 int sysfs_stat(struct sysfs_cxt *cxt, const char *attr, struct stat *st)