Browse code

clamscan: bb#5428

David Raynor authored on 2012/07/06 01:45:07
Showing 1 changed files
... ...
@@ -446,7 +446,10 @@ static int scanstdin(const struct cl_engine *engine, const struct optstruct *opt
446 446
 	return 2;
447 447
     }
448 448
 
449
-    file = cli_gentemp(tmpdir);
449
+    if(!(file = cli_gentemp(tmpdir))) {
450
+	logg("!Can't generate tempfile name\n");
451
+	return 2;
452
+    }
450 453
 
451 454
     if(!(fs = fopen(file, "wb"))) {
452 455
 	logg("!Can't open %s for writing\n", file);
... ...
@@ -569,6 +572,7 @@ int scanmanager(const struct optstruct *opts)
569 569
 	    while(opt) {
570 570
 		if(!(pua_cats = realloc(pua_cats, i + strlen(opt->strarg) + 3))) {
571 571
 		    logg("!Can't allocate memory for pua_cats\n");
572
+		    cl_engine_free(engine);
572 573
 		    return 2;
573 574
 		}
574 575
 		sprintf(pua_cats + i, ".%s", opt->strarg);