Browse code

Clear up earlier in the case of an error

git-svn: trunk@1783

Nigel Horne authored on 2005/12/13 07:17:06
Showing 1 changed files
... ...
@@ -22,7 +22,7 @@
22 22
  *
23 23
  * For installation instructions see the file INSTALL that came with this file
24 24
  */
25
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.222 2005/12/11 16:55:57 nigelhorne Exp $";
25
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.223 2005/12/12 22:17:06 nigelhorne Exp $";
26 26
 
27 27
 #define	CM_VERSION	"devel-111205"
28 28
 
... ...
@@ -3717,6 +3717,9 @@ connect2clamd(struct privdata *privdata)
3717 3717
 		}
3718 3718
 		privdata->filename = (char *)cli_malloc(strlen(dir) + 12);
3719 3719
 
3720
+		if(privdata->filename == NULL)
3721
+			return 0;
3722
+
3720 3723
 		do {
3721 3724
 			sprintf(privdata->filename, "%s/msg.XXXXXX", dir);
3722 3725
 #if	defined(C_LINUX) || defined(C_BSD) || defined(HAVE_MKSTEMP) || defined(C_SOLARIS)
... ...
@@ -3735,6 +3738,8 @@ connect2clamd(struct privdata *privdata)
3735 3735
 			perror(privdata->filename);
3736 3736
 			if(use_syslog)
3737 3737
 				syslog(LOG_ERR, _("Temporary quarantine file %s creation failed"), privdata->filename);
3738
+			free(privdata->filename);
3739
+			privdata->filename = NULL;
3738 3740
 			return 0;
3739 3741
 		}
3740 3742
 		privdata->serverNumber = 0;