Coverity issue: 362901
Fixes:
a1711f948d ("pipeline: add SWX Rx and extract instructions")
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
{
struct instruction *instr = NULL;
struct instruction_data *data = NULL;
- char *string = NULL;
int err = 0;
uint32_t i;
}
for (i = 0; i < n_instructions; i++) {
- string = strdup(instructions[i]);
+ char *string = strdup(instructions[i]);
if (!string) {
err = ENOMEM;
goto error;
}
err = instr_translate(p, a, string, &instr[i], &data[i]);
- if (err)
+ if (err) {
+ free(string);
goto error;
+ }
free(string);
}
if (err)
goto error;
- free(data);
-
if (a) {
a->instructions = instr;
a->n_instructions = n_instructions;
p->n_instructions = n_instructions;
}
+ free(data);
return 0;
error:
- free(string);
free(data);
free(instr);
return err;