Browse code

bb #5199 and bb #5200

David Raynor authored on 2012/09/14 23:38:56
Showing 1 changed files
... ...
@@ -2066,9 +2066,7 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
2066 2066
 			    cli_errmsg("bytecode: called function out of range: %u > %u\n", inst->u.ops.funcid, bc->num_func);
2067 2067
 			    ret = CL_EBYTECODE;
2068 2068
 			}
2069
-            if (ret != CL_SUCCESS)
2070
-                break;
2071
-			if (inst->u.ops.numOps != target->numArgs) {
2069
+			else if (inst->u.ops.numOps != target->numArgs) {
2072 2070
 			    cli_errmsg("bytecode: call operands don't match function prototype\n");
2073 2071
 			    ret = CL_EBYTECODE;
2074 2072
 			}
... ...
@@ -2078,19 +2076,20 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
2078 2078
 			    cli_errmsg("bytecode: call operands don't match function prototype\n");
2079 2079
 			    ret = CL_EBYTECODE;
2080 2080
 			}
2081
-            if (ret != CL_SUCCESS)
2082
-                break;
2083 2081
 		    }
2084
-		    if (inst->u.ops.numOps) {
2082
+		    if (ret != CL_SUCCESS)
2083
+			break;
2084
+		    if (inst->u.ops.numOps > 0) {
2085 2085
 			inst->u.ops.opsizes = cli_malloc(sizeof(*inst->u.ops.opsizes)*inst->u.ops.numOps);
2086 2086
 			if (!inst->u.ops.opsizes) {
2087 2087
 			    cli_errmsg("Out of memory when allocating operand sizes\n");
2088 2088
 			    ret = CL_EMEM;
2089
+			    break;
2089 2090
 			}
2090
-		    } else
2091
+		    } else {
2091 2092
 			inst->u.ops.opsizes = NULL;
2092
-            if (ret != CL_SUCCESS)
2093
-                break;
2093
+			break;
2094
+		    }
2094 2095
 		    for (k=0;k<inst->u.ops.numOps;k++) {
2095 2096
 			MAPPTR(inst->u.ops.ops[k]);
2096 2097
 			if (inst->opcode == OP_BC_CALL_DIRECT)