summaryrefslogtreecommitdiff
path: root/libfshelp/fshelp.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-10 23:31:46 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-10 23:36:36 +0000
commit53f5ddbeeb59d8f551bfe0f3039434483ace1ff4 (patch)
treeffda093d58231ac281d613dfd27ce7f5dd3bd911 /libfshelp/fshelp.h
parent479b6312fb2dc46cd5a096f7ea747a575401f11d (diff)
libfshelp: Fix memleak
* libfshelp/fshelp.h (fshelp_rlock_po_fini): New inline function. * libdiskfs/peropen-rele.c (diskfs_release_peropen): Call fshelp_rlock_po_fini. * libnetfs/release-peropen.c (netfs_release_peropen): Likewise.
Diffstat (limited to 'libfshelp/fshelp.h')
-rw-r--r--libfshelp/fshelp.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libfshelp/fshelp.h b/libfshelp/fshelp.h
index 4f0c693ed..91bbfe50e 100644
--- a/libfshelp/fshelp.h
+++ b/libfshelp/fshelp.h
@@ -298,6 +298,21 @@ error_t fshelp_rlock_po_init (struct rlock_peropen *po)
/* Release all of the locks held by a given peropen. */
error_t fshelp_rlock_drop_peropen (struct rlock_peropen *po);
+/* Drop the peropen identifier */
+error_t fshelp_rlock_po_fini (struct rlock_peropen *po);
+
+#if defined(__USE_EXTERN_INLINES) || defined(DISKFS_DEFINE_EXTERN_INLINE)
+
+FSHELP_EXTERN_INLINE
+error_t fshelp_rlock_po_fini (struct rlock_peropen *po)
+{
+ free (po->locks);
+ po->locks = NULL;
+ return 0;
+}
+
+#endif /* Use extern inlines. */
+
/* Call when a user makes a request to tweak a lock as via fcntl. There
should be one rlock box per object. BOX is the rlock box associated
with the object. MUT is a mutex which should be held whenever this