bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 3/3] libfshelp: properly free active translator entries


From: Justus Winter
Subject: [PATCH 3/3] libfshelp: properly free active translator entries
Date: Tue, 8 Oct 2013 15:49:04 +0200

Previously the dynamically allocated field name leaks. Fix this by
properly freeing the objects of type struct translator.

* libfshelp/translator-list.c (translator_ihash_cleanup): Fix memory leak.
---
 libfshelp/translator-list.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c
index 99a858f..87dcb21 100644
--- a/libfshelp/translator-list.c
+++ b/libfshelp/translator-list.c
@@ -47,9 +47,12 @@ static pthread_mutex_t translator_ihash_lock = 
PTHREAD_MUTEX_INITIALIZER;
 static void
 translator_ihash_cleanup (void *element, void *arg)
 {
+  struct translator *translator = element;
+
   /* No need to deallocate port, we only keep the name of the
      port, not a reference.  */
-  free (element);
+  free (translator->name);
+  free (translator);
 }
 
 /* Record an active translator being bound to the given file name
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]