samba-vscan/nai vscan-mcdaemon_core.c,1.1.2.2,1.1.2.3

[email protected]
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/nai
In directory sc8-pr-cvs1:/tmp/cvs-serv19342/nai

Modified Files:
      Tag: VSCAN_0_3
	vscan-mcdaemon_core.c 
Log Message:
close input/output streams to avoid memory leaks 


Index: vscan-mcdaemon_core.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/nai/Attic/vscan-mcdaemon_core.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- vscan-mcdaemon_core.c	5 Dec 2003 14:29:53 -0000	1.1.2.2
+++ vscan-mcdaemon_core.c	3 Jan 2004 14:59:41 -0000	1.1.2.3
@@ -108,6 +108,8 @@
 
 	fpout = fdopen(sockfd, "w");
 	if ( fpout == NULL ) {
+		/* closing fpin */
+		fclose(fpin);
 		vscan_syslog("ERROR: can not open stream for writing - %s", strerror(errno));
 		return -1;
 	}
@@ -126,6 +128,9 @@
 	/* write to socket-stream */
 	if ( fputs(mcafeeCommand, fpout) == EOF) {
 		vscan_syslog("ERROR: can not send file name to McDaemon!");
+		/* closing streams */
+		fclose(fpin);
+		fclose(fpout);
 		return -1;
 	}
 
@@ -138,8 +143,15 @@
 	/* read from socket-stream */
 	if ( fgets(recvline, MAXLINE, fpin) == NULL ) {
 		vscan_syslog("ERROR: can not get result from McDaemon!");
+		/* closing streams */
+		fclose(fpin);
+		fclose(fpout);
 		return -1;
 	}
+
+	/* closing streams */
+	fclose(fpin);
+	fclose(fpout);
 
 	/* Response from McDaemon is either
 	   - OK                  file scanned and not infected




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.