From 17a9dff769f6e7e4733b4cd1932a2b4731bef55b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 6 Mar 2011 11:18:19 +0900 Subject: [PATCH] Avoid freeing an operand twice. Due to the way operands are used, they can be freed twice in dead-statement removal. Detect the double-free and ignore it. --- tools/qfcc/source/statements.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index dbf4b88ee..3183d99ce 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -182,6 +182,12 @@ new_operand (op_type_e op) static void free_operand (operand_t *op) { + if (op->next) { + //FIXME this should be an error, but due to the way operands are use, + //it can happen. + debug (0, "free_operand: double free"); + return; + } op->next = free_operands; free_operands = op; }