Skip to content

Commit

Permalink
Don't call free on paths which are about to call _Exit. (WebAssem…
Browse files Browse the repository at this point in the history
…bly#161)

This is a minor code-size optimization.
  • Loading branch information
sunfishcode authored Feb 14, 2020
1 parent c6f2c05 commit 2c2fc9a
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions libc-bottom-half/libpreopen/libpreopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,11 @@ __wasilibc_populate_libpreopen(void)
// TODO: Remove the cast on `path` once the witx is updated with char8 support.
ret = __wasi_fd_prestat_dir_name(fd, (uint8_t *)path, prestat.u.dir.pr_name_len);
if (ret != __WASI_ERRNO_SUCCESS) {
free(path);
goto oserr;
}
path[prestat.u.dir.pr_name_len] = '\0';

if (internal_register_preopened_fd(fd, path) != 0) {
free(path);
goto software;
}

Expand Down

0 comments on commit 2c2fc9a

Please sign in to comment.