Skip to content

Resource leak when subprocess_create_ex() fails #85

@wn2000

Description

@wn2000

The subprocess_create_ex() function just has return -1 in case of an error, without properly closing already open file descriptors.

Example:

subprocess.h/subprocess.h

Lines 876 to 880 in 7e59b69

if (0 != posix_spawnp(&child, commandLine[0], &actions, SUBPROCESS_NULL,
(char *const *)commandLine, used_environment)) {
posix_spawn_file_actions_destroy(&actions);
return -1;
}

In my test, trying to call this function with a non-existing command results in 6 more new FDs each time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions