summaryrefslogtreecommitdiffstats
path: root/partx/partx.c
diff options
context:
space:
mode:
authorKarel Zak2012-02-01 09:13:55 +0100
committerKarel Zak2012-02-01 09:13:55 +0100
commit43e3f0541718896a7288538585b79afa1f15e1b0 (patch)
tree657e07f5df335e2825f90171a3d8e57e296d194d /partx/partx.c
parentfsck.cramfs: mark usage() as noreturn (diff)
downloadkernel-qcow2-util-linux-43e3f0541718896a7288538585b79afa1f15e1b0.tar.gz
kernel-qcow2-util-linux-43e3f0541718896a7288538585b79afa1f15e1b0.tar.xz
kernel-qcow2-util-linux-43e3f0541718896a7288538585b79afa1f15e1b0.zip
partx: fix small leak
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'partx/partx.c')
-rw-r--r--partx/partx.c8
1 files changed, 5 insertions, 3 deletions
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);