summaryrefslogtreecommitdiff
path: root/lib/os2-spawn.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-12-10 23:43:20 +0100
committerBruno Haible <bruno@clisp.org>2020-12-11 00:52:28 +0100
commit800920c4b37502e59927464c05c9ca65db0390e3 (patch)
tree376b6a4b4bb4c4a3ec345de1cab50abdbcfcdb97 /lib/os2-spawn.h
parent3cd245c6a6e8823af3a5b23099c84cf99e6a12dc (diff)
downloadgnulib-800920c4b37502e59927464c05c9ca65db0390e3.tar.gz
execute, spawn-pipe: Fix memory leak on native Windows.
* lib/windows-spawn.h (prepare_spawn): Add a second parameter. * lib/windows-spawn.c: Don't include xalloc.h. (quoted_arg_length, quoted_arg_string): New functions, extracted from prepare_spawn. (prepare_spawn): Use malloc instead of XNMALLOC. Allocate memory for all elements of *new_argv together. * modules/windows-spawn (Depends-on): Remove xalloc. Add malloc-posix. * lib/os2-spawn.h (prepare_spawn): Add a second parameter. * lib/os2-spawn.c: Don't include xalloc.h. (prepare_spawn): Use malloc instead of XNMALLOC. Allocate memory for all elements of *new_argv together. * lib/execute.c: Include xalloc.h. (execute): Check return value of prepare_spawn. Free the memory allocated by prepare_spawn. * modules/execute (Depends-on): Add xalloc-die. * lib/spawn-pipe.c: Include xalloc.h. (create_pipe): Check return value of prepare_spawn. Free the memory allocated by prepare_spawn. * modules/spawn-pipe (Depends-on): Add xalloc-die.
Diffstat (limited to 'lib/os2-spawn.h')
-rw-r--r--lib/os2-spawn.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/os2-spawn.h b/lib/os2-spawn.h
index 701cc10c5e..4c8c6a89fd 100644
--- a/lib/os2-spawn.h
+++ b/lib/os2-spawn.h
@@ -27,6 +27,6 @@ extern int dup_safer_noinherit (int fd);
extern void undup_safer_noinherit (int tempfd, int origfd);
/* Prepares an argument vector before calling spawn(). */
-extern char ** prepare_spawn (char **argv);
+extern char ** prepare_spawn (char **argv, char **mem_to_free);
#endif /* _OS2_SPAWN_H */