From: Karel Zak Date: Wed, 1 Feb 2012 08:13:55 +0000 (+0100) Subject: partx: fix small leak X-Git-Tag: v2.21-rc2~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=43e3f0541718896a7288538585b79afa1f15e1b0;p=thirdparty%2Futil-linux.git partx: fix small leak Signed-off-by: Karel Zak --- diff --git a/partx/partx.c b/partx/partx.c index 43b59a2542..e5f4319c89 100644 --- a/partx/partx.c +++ b/partx/partx.c @@ -165,14 +165,16 @@ static int get_partno_from_device(char *partition, dev_t devno) if (devno) { struct sysfs_cxt cxt; + int rc; if (sysfs_init(&cxt, devno, NULL)) goto err; - if (sysfs_read_int(&cxt, "partition", &partno) >= 0) { - sysfs_deinit(&cxt); + rc = sysfs_read_int(&cxt, "partition", &partno); + sysfs_deinit(&cxt); + + if (rc == 0) return partno; - } } sz = strlen(partition);