v3d/qpu: Avoid leaking memory in the QPU disasm test.

Required to run this test under ASan, as we'll be soon doing for building
ARM drivers with asan testing.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9070>
This commit is contained in:
Eric Anholt 2021-02-15 11:02:58 -08:00 committed by Marge Bot
parent 3f77604623
commit a687e71afd

View file

@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include "util/macros.h"
#include "util/ralloc.h"
#include "broadcom/common/v3d_device_info.h"
#include "broadcom/qpu/qpu_disasm.h"
#include "broadcom/qpu/qpu_instr.h"
@ -139,6 +140,7 @@ main(int argc, char **argv)
retval = 1;
continue;
}
ralloc_free((void *)disasm_output);
struct v3d_qpu_instr instr;
if (!v3d_qpu_instr_unpack(&devinfo, tests[i].inst, &instr)) {
@ -178,6 +180,7 @@ main(int argc, char **argv)
const char *redisasm = v3d_qpu_disasm(&devinfo, repack);
printf(" Got: \"%s\"\n", redisasm);
retval = 1;
ralloc_free((void *)redisasm);
}
printf("PASS\n");