diff --git a/App/lib/core/Gen/StructGenMixin.vp b/App/lib/core/Gen/StructGenMixin.vp index c90cc08..f529000 100644 --- a/App/lib/core/Gen/StructGenMixin.vp +++ b/App/lib/core/Gen/StructGenMixin.vp @@ -722,7 +722,7 @@ class StructGenMixin: pre_len_lf: t.CSizeT = t.CSizeT( t.CUInt64T(dot_ty_lf) - t.CUInt64T(ty_name)) if pre_len_lf == 16: - sha_buf_lf: str = pool.alloc(17) + sha_buf_lf: str = stdlib.malloc(17) if sha_buf_lf is not None: string.strncpy(sha_buf_lf, ty_name, 16) sha_buf_lf[16] = '\0' @@ -746,9 +746,13 @@ class StructGenMixin: fe: GenTypes.FieldEntry | t.CPtr = self._get_field_entry(entry, fi) if fe is not None and fe.Name is not None: if string.strcmp(fe.Name, field_name) == 0: + if ty_sha1_lf is not None: + stdlib.free(ty_sha1_lf) return fe # 名称匹配但字段未找到,继续检查其他同名 entry(跨模块同名) continue + if ty_sha1_lf is not None: + stdlib.free(ty_sha1_lf) # 所有条目都未匹配 return None