From 43e3f0541718896a7288538585b79afa1f15e1b0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 1 Feb 2012 09:13:55 +0100 Subject: partx: fix small leak Signed-off-by: Karel Zak --- partx/partx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'partx/partx.c') diff --git a/partx/partx.c b/partx/partx.c index 43b59a254..e5f4319c8 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); -- cgit v1.2.3-55-g7522