From: Francesco Chemolli Date: Fri, 8 Feb 2013 10:13:05 +0000 (-0700) Subject: Fix memory leaks and segmentation faults in librfcnb parser X-Git-Tag: SQUID_3_3_1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b23b231c10f299790e2583d3293e0086cac137d;p=thirdparty%2Fsquid.git Fix memory leaks and segmentation faults in librfcnb parser Detected by Coverity Scan. Issues 740426, 740427, 740499. --- diff --git a/lib/rfcnb/session.c b/lib/rfcnb/session.c index 58ee6b190b..4aaf11b764 100644 --- a/lib/rfcnb/session.c +++ b/lib/rfcnb/session.c @@ -79,6 +79,7 @@ RFCNB_Call(char *Called_Name, char *Calling_Name, char *Called_Address, int port con->errn = 0; /* no error yet */ con->timeout = 0; /* no timeout */ con->redirects = 0; + con->redirect_list = con->last_addr = NULL; /* Resolve that name into an IP address */ @@ -208,6 +209,7 @@ RFCNB_Send(struct RFCNB_Con *Con_Handle, struct RFCNB_Pkt *udata, int Length) /* No need to change RFCNB_errno as it was done by put_pkt ... */ + RFCNB_Free_Pkt(pkt); return (RFCNBE_Bad); /* Should be able to write that lot ... */ } @@ -256,7 +258,7 @@ RFCNB_Recv(void *con_Handle, struct RFCNB_Pkt *Data, int Length) #ifdef RFCNB_DEBUG fprintf(stderr, "Bad packet return in RFCNB_Recv... \n"); #endif - + RFCNB_Free_Pkt(pkt); return (RFCNBE_Bad); }