diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-11-10 23:31:46 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-11-10 23:36:36 +0000 |
commit | 53f5ddbeeb59d8f551bfe0f3039434483ace1ff4 (patch) | |
tree | ffda093d58231ac281d613dfd27ce7f5dd3bd911 /libfshelp | |
parent | 479b6312fb2dc46cd5a096f7ea747a575401f11d (diff) | |
download | hurd-53f5ddbeeb59d8f551bfe0f3039434483ace1ff4.tar.gz hurd-53f5ddbeeb59d8f551bfe0f3039434483ace1ff4.tar.bz2 hurd-53f5ddbeeb59d8f551bfe0f3039434483ace1ff4.zip |
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')
-rw-r--r-- | libfshelp/fshelp.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libfshelp/fshelp.h b/libfshelp/fshelp.h index 4f0c693e..91bbfe50 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 |