]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
partx: fix small leak
authorKarel Zak <kzak@redhat.com>
Wed, 1 Feb 2012 08:13:55 +0000 (09:13 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Feb 2012 08:13:55 +0000 (09:13 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
partx/partx.c

index 43b59a254207798c991c7141d0f7b35192fe9ff4..e5f4319c898d5b0ab05b111b1fb2306a6a6f5803 100644 (file)
@@ -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);