unly deinit arg when arg is not NULL

This commit is contained in:
lyon1998 2022-03-17 12:54:26 +08:00
parent d133f11c20
commit bca1db28c4
2 changed files with 8 additions and 5 deletions

View File

@ -839,7 +839,9 @@ void constPool_init(ConstPool* self) {
}
void constPool_deinit(ConstPool* self) {
arg_deinit(self->arg_buff);
if (NULL != self->arg_buff) {
arg_deinit(self->arg_buff);
}
}
void constPool_append(ConstPool* self, char* content) {
@ -933,8 +935,10 @@ void instructArray_init(InstructArray* self) {
self->content_offset_now = 0;
}
void instructArray_deinit(InstructArray* ins_array) {
arg_deinit(ins_array->arg_buff);
void instructArray_deinit(InstructArray* self) {
if (NULL != self->arg_buff) {
arg_deinit(self->arg_buff);
}
}
void instructArray_append(InstructArray* self, InstructUnit* ins_unit) {

View File

@ -104,7 +104,6 @@ char* constPool_getByOffset(ConstPool* self, uint16_t offset);
uint16_t constPool_getLastOffset(ConstPool* self);
void constPool_print(ConstPool* self);
void byteCodeFrame_init(ByteCodeFrame* bf);
void byteCodeFrame_deinit(ByteCodeFrame* bf);
size_t byteCodeFrame_getSize(ByteCodeFrame* bf);
@ -118,7 +117,6 @@ void instructArray_print(InstructArray* self);
void byteCodeFrame_print(ByteCodeFrame* self);
InstructUnit* instructArray_getByOffset(InstructArray* self, int32_t offset);
#define instructUnit_getSize(InstructUnit_p_self) ((size_t)sizeof(InstructUnit))
#define instructArray_getSize(InsturctArry_p_self) \
((size_t)(InsturctArry_p_self)->size)
@ -132,5 +130,6 @@ VMParameters* pikaVM_runByteCodeWithState(PikaObj* self,
uint16_t constPool_getOffsetByData(ConstPool* self, char* data);
void instructArray_printWithConst(InstructArray* self, ConstPool* const_pool);
void constPool_update(ConstPool* self);
void instructArray_update(InstructArray* self);
#endif