tisc

tiny instruction set computer
Log | Files | Refs | README

commit 103f0c3884b8ac2fab638d3ac31ef13a23c701a6
parent 38ccb1ce2b22e77b55d1e45d4457a964fb4a2910
Author: Paul Longtine <paul@nanner.co>
Date:   Sun, 19 Jun 2022 21:39:39 -0400

Fix missing calls to `free`

Diffstat:
Mtisc.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/tisc.c b/tisc.c @@ -632,6 +632,7 @@ void print_instruction_header(int label_width) strncpy(label_str, "label", 5); printf("ln# [addr]:%s <op> <args>\n", label_str); + free(label_str); } /* void print_instruction -> prints the instruction with some helpful information @@ -669,6 +670,11 @@ void print_instruction(int line, int* address, char *label, char *opcode, char * } printf("%03i [0x%02x]:%s %s\t%s\n", line, *address, label_str, opcode, arg_str); + free(label_str); + if (strlen(arg_str) != 0) + { + free(arg_str); + } } int output_file(FILE* output, uint8_t* bytes, int size)