cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: cmogstored-public@bogomips.org
Subject: [PATCH] use free_mount_entry from gnulib instead of rolling our own
Date: Wed, 11 Nov 2015 04:01:21 +0000	[thread overview]
Message-ID: <20151111040121.857-1-e@80x24.org> (raw)

gnulib.git added the me_mntroot element in
commit c6148bca89e9465fd6ba3a10d273ec4cb58c2dbe,
so we would leak memory during filesystem refreshes as a result :x
Use the gnulib-provided API (free_mount_entry) instead of freeing
elements ourselves.
---
 mnt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mnt.c b/mnt.c
index ca4bdf8..8431c0f 100644
--- a/mnt.c
+++ b/mnt.c
@@ -28,13 +28,11 @@ static void me_free(void *entry)
 	struct mount_entry *me = entry;
 
 	do {
-		free(me->me_devname);
-		free(me->me_mountdir);
 		assert(me->me_type == NULL
 		       && me->me_type_malloced == 0
 		       && "me_type still malloc-ed in mountlist");
 		next = me->me_next;
-		free(me);
+		free_mount_entry(me);
 	} while ((me = next));
 }
 
-- 
EW


                 reply	other threads:[~2015-11-11  4:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://yhbt.net/cmogstored/README

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

  git send-email \
    --in-reply-to=20151111040121.857-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=cmogstored-public@bogomips.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.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/cmogstored.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).