]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Call posix_spawnattr_destroy after calling posix_spawn so that
authorRoy Marples <roy@marples.name>
Fri, 31 Mar 2017 11:04:09 +0000 (12:04 +0100)
committerRoy Marples <roy@marples.name>
Fri, 31 Mar 2017 11:04:09 +0000 (12:04 +0100)
any memory allocated by posix_spawnattr_init is reclaimed.

Fixes a memory leak on FreeBSD and OpenBSD.

src/script.c

index dcac0d4bea17e062f1b7b129f9c4fc3d3b83a500..d5fd43e630d2557426f04cb23d3a4e826ecdfb58 100644 (file)
@@ -110,6 +110,7 @@ exec_script(const struct dhcpcd_ctx *ctx, char *const *argv, char *const *env)
 #endif
        errno = 0;
        r = posix_spawn(&pid, argv[0], NULL, &attr, argv, env);
+       posix_spawnattr_destroy(&attr);
        if (r) {
                errno = r;
                return -1;