diff --git a/utils/imxtools/sb.c b/utils/imxtools/sb.c index 44db56b7d1..23b89e52c8 100644 --- a/utils/imxtools/sb.c +++ b/utils/imxtools/sb.c @@ -1039,13 +1039,16 @@ struct sb_file_t *sb_read_file(const char *filename, bool raw_mode, void *u, #undef print_hex } +void sb_free_instruction(struct sb_inst_t inst) +{ + free(inst.padding); + free(inst.data); +} + void sb_free_section(struct sb_section_t sec) { for(int j = 0; j < sec.nr_insts; j++) - { - free(sec.insts[j].padding); - free(sec.insts[j].data); - } + sb_free_instruction(sec.insts[j]); free(sec.insts); } diff --git a/utils/imxtools/sb.h b/utils/imxtools/sb.h index ced6481a80..e0f25b68a4 100644 --- a/utils/imxtools/sb.h +++ b/utils/imxtools/sb.h @@ -231,6 +231,7 @@ struct sb_file_t *sb_read_file(const char *filename, bool raw_mode, void *u, void sb_fill_section_name(char name[5], uint32_t identifier); void sb_dump(struct sb_file_t *file, void *u, sb_color_printf printf); +void sb_free_instruction(struct sb_inst_t inst); void sb_free_section(struct sb_section_t file); void sb_free(struct sb_file_t *file);