TITLE: Executor leaks pipe handles on error
DESCRIPTION: Correct the pipe handle clean-up logic on error conditions.
if (pipe(from) != 0)
{
+ close(to[0]);
+ close(to[1]);
status = -1;
break;
}
if (pid < 0)
{
Log(LL_SEVERE, "fork failed");
+ close(to[0]);
+ close(to[1]);
+ close(from[0]);
+ close(from[1]);
status = -1;
break;
}
request.module);
_exit(1);
}
- }
- while (0);
- /* Close unused pipe descriptors. */
+ /* We are the parent process. Close the child's ends of the pipes. */
- close(to[0]);
- close(from[1]);
+ close(to[0]);
+ close(from[1]);
+ }
+ while (0);
/* Send response. */