From: Karel Zak Date: Fri, 27 May 2011 12:47:40 +0000 (+0200) Subject: lib: [sysfs.c] fix double free X-Git-Tag: v2.20-rc1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87e77645f5e51879c492d79ceb88a5a0bf15d856;p=thirdparty%2Futil-linux.git lib: [sysfs.c] fix double free Signed-off-by: Karel Zak --- diff --git a/lib/sysfs.c b/lib/sysfs.c index 524c97f557..b9ddc67f5e 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -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)