Skip to content

Commit

Permalink
Fix some minor memory leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Mar 15, 2024
1 parent 06e8946 commit 55f9718
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/windows/spl/spl-taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id)
if (tqdnode == task) {
/*
* First check if it has already started
* executing, if so, we want for signal
* executing, if so, we wait for signal
* that it has finished and restart the loop.
*/
if (tqdnode->tqd_ent != TASKQID_INVALID) {
Expand Down
2 changes: 2 additions & 0 deletions module/os/windows/spl/spl-vnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,8 @@ vnode_drain_delayclose(int force)
vnode_unlock(vp);
dprintf("%s: freeing DEAD vp %p\n", __func__, vp);

vnode_set_reparse(vp, NULL, 0);
ASSERT0(vnode_security(vp));
kmem_cache_free(vnode_cache, vp);
atomic_dec_64(&vnode_active);

Expand Down
8 changes: 8 additions & 0 deletions module/os/windows/zfs/zfs_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ zfs_rmnode(znode_t *zp)
objset_t *os = zfsvfs->z_os;
znode_t *xzp = NULL;
dmu_tx_t *tx;
znode_hold_t *zh;
uint64_t z_id = zp->z_id;
uint64_t acl_obj;
uint64_t xattr_obj;
int error;
Expand All @@ -678,7 +680,9 @@ zfs_rmnode(znode_t *zp)
* Not enough space to delete some xattrs.
* Leave it in the unlinked set.
*/
zh = zfs_znode_hold_enter(zfsvfs, z_id);
zfs_znode_dmu_fini(zp);
zfs_znode_hold_exit(zfsvfs, zh);

return;
}
Expand All @@ -698,7 +702,9 @@ zfs_rmnode(znode_t *zp)
* Not enough space or we were interrupted by unmount.
* Leave the file in the unlinked set.
*/
zh = zfs_znode_hold_enter(zfsvfs, z_id);
zfs_znode_dmu_fini(zp);
zfs_znode_hold_exit(zfsvfs, zh);
return;
}
}
Expand Down Expand Up @@ -739,7 +745,9 @@ zfs_rmnode(znode_t *zp)
* which point we'll call zfs_unlinked_drain() to process it).
*/
dmu_tx_abort(tx);
zh = zfs_znode_hold_enter(zfsvfs, z_id);
zfs_znode_dmu_fini(zp);
zfs_znode_hold_exit(zfsvfs, zh);
goto out;
}

Expand Down
2 changes: 2 additions & 0 deletions module/os/windows/zfs/zfs_vnops_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -8208,6 +8208,7 @@ fastio_query_open(PIRP Irp,
dprintf("RtlUnicodeToUTF8N returned 0x%x "
"input len %d\n",
error, IrpSp->FileObject->FileName.Length);
kmem_free(filename, PATH_MAX);
Irp->IoStatus.Status = STATUS_OBJECT_NAME_INVALID;
Irp->IoStatus.Information = 0;
return (FALSE);
Expand Down Expand Up @@ -8324,4 +8325,5 @@ fastio_init(FAST_IO_DISPATCH **fast)
*fast = &FastIoDispatch;
dprintf("Using FASTIO\n");
#endif // ZFS_HAVE_FASTIO

}
2 changes: 2 additions & 0 deletions module/os/windows/zfs/zfs_znode.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ zfs_znode_cache_destructor(void *buf, void *arg)
static int
zfs_znode_hold_cache_constructor(void *buf, void *arg, int kmflags)
{
(void) arg, (void) kmflags;
znode_hold_t *zh = buf;

mutex_init(&zh->zh_lock, NULL, MUTEX_DEFAULT, NULL);
Expand All @@ -215,6 +216,7 @@ zfs_znode_hold_cache_constructor(void *buf, void *arg, int kmflags)
static void
zfs_znode_hold_cache_destructor(void *buf, void *arg)
{
(void) arg;
znode_hold_t *zh = buf;

mutex_destroy(&zh->zh_lock);
Expand Down

0 comments on commit 55f9718

Please sign in to comment.