Free the conn->sockdata on failure. conn->fd is not set until the
bottom, and before it is set, conn->conn_close() will not be called.
Close the pin pipe if the pout pipe fails.
Call mutt_perror first on a fork failure. Calling after the close()
may cause errno to be changed on a close failure.
if ((rc = pipe (pin)) == -1)
{
mutt_perror ("pipe");
+ FREE (&conn->sockdata);
return -1;
}
if ((rc = pipe (pout)) == -1)
{
mutt_perror ("pipe");
+ close (pin[0]);
+ close (pin[1]);
+ FREE (&conn->sockdata);
return -1;
}
if (pid == -1)
{
+ mutt_perror ("fork");
close (pin[0]);
close (pin[1]);
close (pout[0]);
close (pout[1]);
- mutt_perror ("fork");
+ FREE (&conn->sockdata);
return -1;
}
if (close (pin[1]) < 0 || close (pout[0]) < 0)