[PATCH] partx: use sysfs_deinit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Davidlohr Bueso <dave@xxxxxxx>
Date: Sun, 24 Jul 2011 11:29:23 -0400


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@xxxxxxx>
---
 partx/partx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/partx/partx.c b/partx/partx.c
index e29e50d..4f827a8 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -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);
-- 
1.7.4.1



--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux