Skip to content

Commit 2c2fc9a

Browse files
authored
Don't call free on paths which are about to call _Exit. (#161)
This is a minor code-size optimization.
1 parent c6f2c05 commit 2c2fc9a

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

libc-bottom-half/libpreopen/libpreopen.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,11 @@ __wasilibc_populate_libpreopen(void)
547547
// TODO: Remove the cast on `path` once the witx is updated with char8 support.
548548
ret = __wasi_fd_prestat_dir_name(fd, (uint8_t *)path, prestat.u.dir.pr_name_len);
549549
if (ret != __WASI_ERRNO_SUCCESS) {
550-
free(path);
551550
goto oserr;
552551
}
553552
path[prestat.u.dir.pr_name_len] = '\0';
554553

555554
if (internal_register_preopened_fd(fd, path) != 0) {
556-
free(path);
557555
goto software;
558556
}
559557

0 commit comments

Comments
 (0)