fixed memory issues

This commit is contained in:
2025-02-03 22:30:56 +05:00
parent 422d967165
commit 51ef24bb53
7 changed files with 42 additions and 6 deletions

View File

@@ -51,5 +51,15 @@ const Instruction* Instruction_getByName(str name){
}
}
return HashMap_Instruction_tryGetPtr(instructions_map, name);
str name_upper = str_toUpper(name);
Instruction* iptr = HashMap_Instruction_tryGetPtr(instructions_map, name_upper);
free(name_upper.data);
return iptr;
}
void Instruction_freeSearchStructs(){
if(instructions_map != NULL){
HashMap_Instruction_free(instructions_map);
free(instructions_map);
}
}

View File

@@ -35,3 +35,4 @@ typedef struct Instruction {
/// @return ptr to struct or NULL
const Instruction* NULLABLE(Instruction_getByOpcode)(Opcode opcode);
const Instruction* NULLABLE(Instruction_getByName)(str name);
void Instruction_freeSearchStructs();