summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-09-15 09:23:01 -0400
committerTavian Barnes <tavianator@tavianator.com>2021-09-15 09:23:01 -0400
commitea1aa067aeaf41db8e463eb95d64ebdac6002851 (patch)
tree73b70a5e8d25cf8ca3f139a3edabf5679dfe5466
parent353bf701d397565b22355c970c0cf76601c20fc8 (diff)
downloadbfs-ea1aa067aeaf41db8e463eb95d64ebdac6002851.tar.xz
spawn: Plug some leaks on error paths
-rw-r--r--spawn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/spawn.c b/spawn.c
index f83663a..d4ff4fd 100644
--- a/spawn.c
+++ b/spawn.c
@@ -220,6 +220,7 @@ pid_t bfs_spawn(const char *exe, const struct bfs_spawn *ctx, char **argv, char
// Use a pipe to report errors from the child
int pipefd[2];
if (pipe_cloexec(pipefd) != 0) {
+ free(resolved);
return -1;
}
@@ -230,6 +231,7 @@ pid_t bfs_spawn(const char *exe, const struct bfs_spawn *ctx, char **argv, char
error = errno;
close(pipefd[1]);
close(pipefd[0]);
+ free(resolved);
errno = error;
return -1;
} else if (pid == 0) {