]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
partx: use sysfs_deinit
authorDavidlohr Bueso <dave@gnu.org>
Sun, 24 Jul 2011 15:29:23 +0000 (11:29 -0400)
committerKarel Zak <kzak@redhat.com>
Tue, 26 Jul 2011 09:58:38 +0000 (11:58 +0200)
Commit a88268b8cc124b6f721ba17ab01a3f6d5800c749 (get partition number with
sysfs lib) recently added the sysfs library to partx without freeing resources
once finished.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
partx/partx.c

index e29e50dcca7cab7b29c0e1c2d59678b9d4259742..4f827a822289748a9d05977c22b07f7824dd4690 100644 (file)
@@ -137,8 +137,10 @@ static int get_partno_from_device(char *partition, dev_t devno)
                struct sysfs_cxt cxt;
 
                sysfs_init(&cxt, devno, NULL);
-               if (sysfs_read_int(&cxt, "partition", &partno) >= 0)
+               if (sysfs_read_int(&cxt, "partition", &partno) >= 0) {
+                       sysfs_deinit(&cxt);
                        return partno;
+               }
        }
 
        sz = strlen(partition);