Skip to content

Commit e65fe61

Browse files
committed
Fix shocking memory leak on Windows
Spawning processes would leak lots of memory, due to a missing free call in ntspawn(). Our tooling never caught this since ntspawn() must use the WIN32 memory allocator. It means every time posix_spawn, fork, or execve got called, we would leak 162kb of memory. I'm proud to say that's fixed
1 parent 949c398 commit e65fe61

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libc/calls/ntspawn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ textwindows int ntspawn(struct NtSpawnArgs *args) {
238238
BLOCK_SIGNALS;
239239
if ((sb = ntspawn_malloc(sizeof(*sb)))) {
240240
rc = ntspawn2(args, sb);
241+
ntspawn_free(sb);
241242
} else {
242243
rc = -1;
243244
}

0 commit comments

Comments
 (0)