From 497934818b64459ec03c24acaa626fb2ae2beecf Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 20 May 2022 21:27:17 -0400 Subject: [PATCH] Fixed memory leak when closing a DirHandle with a root (thanks, jajiradai!). Fixes #3. --- src/physfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/physfs.c b/src/physfs.c index ef621e8..a5da945 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -1093,6 +1093,8 @@ static int freeDirHandle(DirHandle *dh, FileHandle *openList) BAIL_IF(i->dirHandle == dh, PHYSFS_ERR_FILES_STILL_OPEN, 0); dh->funcs->closeArchive(dh->opaque); + + if (dh->root) allocator.Free(dh->root); allocator.Free(dh->dirName); allocator.Free(dh->mountPoint); allocator.Free(dh);