cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
* [PATCH] use free_mount_entry from gnulib instead of rolling our own
@ 2015-11-11  4:01 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-11-11  4:01 UTC (permalink / raw)
  To: cmogstored-public

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-11  4:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11  4:01 [PATCH] use free_mount_entry from gnulib instead of rolling our own Eric Wong

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).