fix memory leak

closes #24421
This commit is contained in:
Alex Kladov 2025-07-16 10:38:18 +01:00 committed by Andrew Kelley
parent 6002514b72
commit 7d63e777a4

View File

@ -419,6 +419,7 @@ pub const Manifest = struct {
fn addFileInner(self: *Manifest, prefixed_path: PrefixedPath, handle: ?fs.File, max_file_size: ?usize) usize {
const gop = self.files.getOrPutAssumeCapacityAdapted(prefixed_path, FilesAdapter{});
if (gop.found_existing) {
self.cache.gpa.free(prefixed_path.sub_path);
gop.key_ptr.updateMaxSize(max_file_size);
gop.key_ptr.updateHandle(handle);
return gop.index;