Util-Linux package development
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH] partx: use sysfs_deinit
Date: Sun, 24 Jul 2011 18:51:16 -0400	[thread overview]
Message-ID: <1311547876.3367.3.camel@offbook> (raw)

From: Davidlohr Bueso <dave@gnu.org>
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@gnu.org>
---
 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

             reply	other threads:[~2011-07-24 22:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 22:51 Davidlohr Bueso [this message]
2011-07-26 10:14 ` [PATCH] partx: use sysfs_deinit Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311547876.3367.3.camel@offbook \
    --to=dave@gnu.org \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox