bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

execute, spawn-pipe: Fix memory leak on native Windows


From: Bruno Haible
Subject: execute, spawn-pipe: Fix memory leak on native Windows
Date: Fri, 11 Dec 2020 01:01:39 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

The function prepare_spawn in windows-spawn.c and os2-spawn.c was a
long-standing memory leak. The first patch fixes the memory leak
and also the dependency on the 'xalloc' module.

Then, the second patch relicenses the module 'windows-spawn' to LGPLv2+.
I am the sole contributor to lib/w32spawn.h and lib/windows-spawn.[hc],
except for
  - changes by Paul Eggert (2007-01-26) which are too small to be copyright
    relevant,
  - changes by Eric Blake (2009-12-05) that were removed on 2020-11-30,
  - changes by KO Myung-Hun (2016-01-14) that were moved to os2-spawn.[hc]
    on 2020-11-29, and which stay under GPL.


2020-12-10  Bruno Haible  <bruno@clisp.org>

        windows-spawn: Relicense under LGPLv2+.
        * modules/windows-spawn (License): Change to LGPLv2+.

2020-12-10  Bruno Haible  <bruno@clisp.org>

        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.

Attachment: 0001-execute-spawn-pipe-Fix-memory-leak-on-native-Windows.patch
Description: Text Data

Attachment: 0002-windows-spawn-Relicense-under-LGPLv2.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]