fixed memory issues
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user