Browse code

Fix memory leak in runlsig (bb #2291).

Török Edvin authored on 2010/09/28 19:06:14
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Sep 28 13:05:53 EEST 2010 (edwin)
2
+-------------------------------------
3
+ * libclamav/bytecode.c: fix memory leak in runlsig (bb #2291)
4
+
1 5
 Tue Sep 28 13:01:19 EEST 2010 (edwin)
2 6
 -------------------------------------
3 7
  * libclamav/scanners.c: fix VI memory leak (bb #2291)
... ...
@@ -2461,6 +2461,7 @@ int cli_bytecode_runlsig(cli_ctx *cctx, struct cli_target_info *tinfo,
2461 2461
 	/* save match counts */
2462 2462
 	memcpy(&ctx.lsigcnt, lsigcnt, 64*4);
2463 2463
 	memcpy(&ctx.lsigoff, lsigsuboff, 64*4);
2464
+	cli_bytecode_context_clear(&ctx);
2464 2465
 	return CL_SUCCESS;
2465 2466
     }
2466 2467
 
... ...
@@ -2468,6 +2469,7 @@ int cli_bytecode_runlsig(cli_ctx *cctx, struct cli_target_info *tinfo,
2468 2468
     ret = cli_bytecode_run(bcs, bc, &ctx);
2469 2469
     if (ret != CL_SUCCESS) {
2470 2470
 	cli_warnmsg("Bytcode failed to run: %s\n", cl_strerror(ret));
2471
+	cli_bytecode_context_clear(&ctx);
2471 2472
 	return CL_SUCCESS;
2472 2473
     }
2473 2474
     if (ctx.virname) {