From b4d65986302dcb617d7af7abd141cdf5ec93bad4 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 5 Nov 2005 20:44:40 +0000 Subject: [PATCH] * gas-bison.y: Fix a couple use-after-free's. svn path=/trunk/yasm/; revision=1310 --- modules/parsers/gas/gas-bison.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/parsers/gas/gas-bison.y b/modules/parsers/gas/gas-bison.y index 442983c6..c547f295 100644 --- a/modules/parsers/gas/gas-bison.y +++ b/modules/parsers/gas/gas-bison.y @@ -663,13 +663,13 @@ operand: memaddr { $$ = yasm_operand_create_mem($1); } unsigned long reg = yasm_arch_reggroup_get_reg(parser_gas->arch, $1[0], yasm_intnum_get_uint($3)); - yasm_intnum_destroy($3); if (reg == 0) { yasm__error(cur_line, N_("bad register index `%u'"), yasm_intnum_get_uint($3)); $$ = yasm_operand_create_reg($1[0]); } else $$ = yasm_operand_create_reg(reg); + yasm_intnum_destroy($3); } | '$' expr { $$ = yasm_operand_create_imm($2); } | '*' REG { @@ -762,7 +762,7 @@ gas_get_section(yasm_parser_gas *parser_gas, char *name, yasm_section *new_section; yasm_vps_initialize(&vps); - vp = yasm_vp_create(name, NULL); + vp = yasm_vp_create(yasm__xstrdup(name), NULL); yasm_vps_append(&vps, vp); if (!builtin) {