Browse code

Merge branch '0.96' of git.clam.sourcefire.com:/var/lib/git/clamav-devel into 0.96

aCaB authored on 2010/05/18 02:09:57
Showing 2 changed files
... ...
@@ -127,9 +127,13 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
127 127
     ctx->operands = NULL;
128 128
 
129 129
     if (ctx->outfd) {
130
+	cli_ctx *cctx = ctx->ctx;
130 131
 	cli_bcapi_extract_new(ctx, -1);
131 132
 	if (ctx->outfd)
132 133
 	    close(ctx->outfd);
134
+	if (ctx->tempfile && (!cctx || !cctx->engine->keeptmp)) {
135
+	    cli_unlink(ctx->tempfile);
136
+	}
133 137
 	free(ctx->tempfile);
134 138
 	ctx->tempfile = NULL;
135 139
 	ctx->outfd = 0;
... ...
@@ -210,9 +214,6 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
210 210
 int cli_bytecode_context_clear(struct cli_bc_ctx *ctx)
211 211
 {
212 212
     cli_ctx *cctx = (cli_ctx*)ctx->ctx;
213
-    if (ctx->tempfile && (!cctx || !cctx->engine->keeptmp)) {
214
-	cli_unlink(ctx->tempfile);
215
-    }
216 213
     cli_bytecode_context_reset(ctx);
217 214
     memset(ctx, 0, sizeof(*ctx));
218 215
     return CL_SUCCESS;
... ...
@@ -579,17 +579,21 @@ int cli_cvdload(FILE *fs, struct cl_engine *engine, unsigned int *signo, unsigne
579 579
     if(!access(dupname, R_OK) && (dupfs = fopen(dupname, "rb"))) {
580 580
 	if((ret = cli_cvdverify(dupfs, &dupcvd, !cld))) {
581 581
 	    fclose(dupfs);
582
+	    free(dupname);
582 583
 	    return ret;
583 584
 	}
584 585
 	fclose(dupfs);
585 586
 	if(dupcvd.version > cvd.version) {
586 587
 	    cli_warnmsg("Detected duplicate databases %s and %s. The %s database is older and will not be loaded, you should manually remove it from the database directory.\n", filename, dupname, filename);
588
+	    free(dupname);
587 589
 	    return CL_SUCCESS;
588 590
 	} else if(dupcvd.version == cvd.version && !cld) {
589 591
 	    cli_warnmsg("Detected duplicate databases %s and %s, please manually remove one of them\n", filename, dupname);
592
+	    free(dupname);
590 593
 	    return CL_SUCCESS;
591 594
 	}
592 595
     }
596
+    free(dupname);
593 597
 
594 598
     if(strstr(filename, "daily.")) {
595 599
 	time(&s_time);