Do not free ds->opstr after r_parse_immtrim (#17728)

There is no new allocation in r_parse_immtrim, so it is not required to
free the "previous" string.
This commit is contained in:
Riccardo Schirone 2020-10-13 12:40:35 +02:00 committed by GitHub
parent e3999b7fcd
commit ce143ac837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -1051,7 +1051,6 @@ static void ds_build_op_str(RDisasmState *ds, bool print_color) {
if (ds->immtrim) {
char *res = r_parse_immtrim (ds->opstr);
if (res) {
free (ds->opstr);
ds->opstr = res;
}
return;

View File

@ -2213,3 +2213,16 @@ EXPECT=<<EOF
66: parell (char *s);
EOF
RUN
NAME=asm.imm.trim
FILE=bins/elf/crackme0x05
CMDS=<<EOF
s 0x080483d5
pi 1 @e:asm.imm.trim=false
pi 1 @e:asm.imm.trim=true
EOF
EXPECT=<<EOF
and esp, 0xfffffff0
and esp,
EOF
RUN