diff options
author | Bruno Haible <bruno@clisp.org> | 2020-12-10 23:43:20 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-12-11 00:52:28 +0100 |
commit | 800920c4b37502e59927464c05c9ca65db0390e3 (patch) | |
tree | 376b6a4b4bb4c4a3ec345de1cab50abdbcfcdb97 /modules | |
parent | 3cd245c6a6e8823af3a5b23099c84cf99e6a12dc (diff) | |
download | gnulib-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 'modules')
-rw-r--r-- | modules/execute | 1 | ||||
-rw-r--r-- | modules/spawn-pipe | 1 | ||||
-rw-r--r-- | modules/windows-spawn | 2 |
3 files changed, 3 insertions, 1 deletions
diff --git a/modules/execute b/modules/execute index cb04003288..90a7b89c3c 100644 --- a/modules/execute +++ b/modules/execute @@ -32,6 +32,7 @@ stdlib unistd wait-process windows-spawn +xalloc-die configure.ac: gl_EXECUTE diff --git a/modules/spawn-pipe b/modules/spawn-pipe index 9d80193d07..7ad384b524 100644 --- a/modules/spawn-pipe +++ b/modules/spawn-pipe @@ -40,6 +40,7 @@ unistd unistd-safer wait-process windows-spawn +xalloc-die configure.ac: gl_SPAWN_PIPE diff --git a/modules/windows-spawn b/modules/windows-spawn index 4702c50f08..2538333498 100644 --- a/modules/windows-spawn +++ b/modules/windows-spawn @@ -13,7 +13,7 @@ stdint stdlib strpbrk unistd -xalloc +malloc-posix configure.ac: AC_REQUIRE([AC_CANONICAL_HOST]) |