git » libjio » commit 03fb278

Even tho the manpage says that the mutex in Linux don't use up resources, it does.

author Alberto Bertogli
2004-07-25 01:59:26 UTC
committer Alberto Bertogli
2007-07-15 13:16:57 UTC
parent d22c9cac00df425a329258f09e3193d4eb9567e9

Even tho the manpage says that the mutex in Linux don't use up resources, it does.

Even tho the manpage says that the mutex in Linux don't use up resources, it
does.

And even so, for portability, we must destroy the mutex to allow jfs reuse
without memory leaks.

trans.c +2 -0

diff --git a/trans.c b/trans.c
index 4d30a0c..73ced6a 100644
--- a/trans.c
+++ b/trans.c
@@ -127,6 +127,7 @@ void jtrans_free(struct jtrans *ts)
 
 		ts->op = tmpop;
 	}
+	pthread_mutex_destroy(&(ts->lock));
 }
 
 
@@ -617,6 +618,7 @@ int jclose(struct jfs *fs)
 		/* allocated by strdup() in jopen() */
 		free(fs->name);
 	munmap(fs->jmap, sizeof(unsigned int));
+	pthread_mutex_destroy(&(fs->lock));
 
 	return 0;
 }