Skip to contentSkip to conversation

partx: use sysfs_deinit

PATCH Applied Davidlohr Bueso 2 participants 2 messages Jul 24, 2011 – Jul 26, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 partx: use sysfs_deinit

From: Davidlohr Bueso <[email protected]>
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.

---
 partx/partx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
partx/partx.c +3 -1
index e29e50d..4f827a8 100644
@@ -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);
Signature · 1 line
1.7.4.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Davidlohr Bueso
 partx/partx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com