Browse code

libclamav: cli_bytecode_prepare_interpreter() free in error case, cid #10504 & #10505

David Raynor authored on 2013/08/10 04:48:13
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  *  Load, and verify ClamAV bytecode.
3 3
  *
4
- *  Copyright (C) 2009-2012 Sourcefire, Inc.
4
+ *  Copyright (C) 2009-2013 Sourcefire, Inc.
5 5
  *
6 6
  *  Authors: Török Edvin
7 7
  *
... ...
@@ -1960,6 +1960,8 @@ void cli_bytecode_destroy(struct cli_bc *bc)
1960 1960
 	if (o > bc->num_globals) {\
1961 1961
 	    cli_errmsg("bytecode: global out of range: %u > %u, for instruction %u in function %u\n",\
1962 1962
 		       o, (unsigned)bc->num_globals, j, i);\
1963
+	    free(map);\
1964
+	    free(gmap);\
1963 1965
 	    return CL_EBYTECODE;\
1964 1966
 	}\
1965 1967
 	val = 0x80000000 | gmap[o];\
... ...
@@ -1967,6 +1969,8 @@ void cli_bytecode_destroy(struct cli_bc *bc)
1967 1967
     }\
1968 1968
     if (o > totValues) {\
1969 1969
 	cli_errmsg("bytecode: operand out of range: %u > %u, for instruction %u in function %u\n", o, totValues, j, i);\
1970
+	free(map);\
1971
+	free(gmap);\
1970 1972
 	return CL_EBYTECODE;\
1971 1973
     }\
1972 1974
     val = map[o]; } while (0)