Browse code

clamav-milter: better cleanup in exit-on-error from smtpauth_init()

David Raynor authored on 2013/08/16 06:44:49
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C)2008 Sourcefire, Inc.
2
+ *  Copyright (C)2008-2013 Sourcefire, Inc.
3 3
  *
4 4
  *  Author: aCaB <acab@clamav.net>
5 5
  *
... ...
@@ -151,6 +151,7 @@ int smtpauth_init(const char *r) {
151 151
 		regex = realloc(regex, rxsize + 2048);
152 152
 		if(!regex) {
153 153
 		    logg("!Cannot allocate memory for SkipAuthenticated file\n");
154
+		    fclose(f);
154 155
 		    return 1;
155 156
 		}
156 157
 		rxavail = 2048;
... ...
@@ -182,6 +183,7 @@ int smtpauth_init(const char *r) {
182 182
 	}
183 183
 	if(rxavail < 4 && !(regex = realloc(regex, rxsize + 4))) {
184 184
 	    logg("!Cannot allocate memory for SkipAuthenticated file\n");
185
+	    fclose(f);
185 186
 	    return 1;
186 187
 	}
187 188
 	regex[rxused-1] = ')';