Browse code

clamconf: better cleanup on error exit from print_dbs(), cid #10500

David Raynor authored on 2013/08/13 06:54:25
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2009 Sourcefire, Inc.
2
+ *  Copyright (C) 2009-2013 Sourcefire, Inc.
3 3
  *  Author: Tomasz Kojm <tkojm@clamav.net>
4 4
  *
5 5
  *  This program is free software; you can redistribute it and/or modify
... ...
@@ -330,6 +330,7 @@ static void print_dbs(const char *dir)
330 330
 		dbfile = (char *) malloc(strlen(dent->d_name) + strlen(dir) + 2);
331 331
 		if(!dbfile) {
332 332
 		    printf("print_dbs: Can't allocate memory for dbfile\n");
333
+		    closedir(dd);
333 334
 		    return;
334 335
 		}
335 336
 		sprintf(dbfile, "%s"PATHSEP"%s", dir, dent->d_name);