Coverity checker identified that the connect structures were not being
free'd on any of the error cases.
This patch adds several calls to free(con) to prevent the leaks.
It also adds a call to close any partial connections properly when
RFCNB_Session_Req fails. Previously it would leave the open TCP
connection hanging and return a NULL pointer.
if ((errno = RFCNB_Name_To_IP(Service_Address, &Dest_IP)) < 0) { /* Error */
/* No need to modify RFCNB_errno as it was done by RFCNB_Name_To_IP */
-
+ free(con);
return (NULL);
}
RFCNB_errno = RFCNBE_NoSpace;
RFCNB_saved_errno = errno;
+ free(con);
return (NULL);
}
if ((Client = RFCNB_IP_Connect(Dest_IP, port)) < 0) { /* Error */
/* No need to modify RFCNB_errno as it was done by RFCNB_IP_Connect */
-
+ free(con);
return (NULL);
}
&redirect, &Dest_IP, &port)) < 0) {
/* No need to modify RFCNB_errno as it was done by RFCNB_Session.. */
-
+ RFCNB_Close(con->fd); /* Close it */
+ free(con);
return (NULL);
}