]> git.proxmox.com Git - wasi-libc.git/commitdiff
Don't call `free` on paths which are about to call `_Exit`. (#161)
authorDan Gohman <sunfish@mozilla.com>
Fri, 14 Feb 2020 22:02:59 +0000 (14:02 -0800)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2020 22:02:59 +0000 (14:02 -0800)
This is a minor code-size optimization.

libc-bottom-half/libpreopen/libpreopen.c

index 25c104066f3f1df23c1f3d2fa7205889c6facf21..789fe8d4ebd51288f24ed02b028aa96ee3cc6eda 100644 (file)
@@ -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;
             }