mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 13:30:45 +00:00
stage2: Fix UAF in ErrorMsg destructor
After calling gpa.destroy the object is gone for good, setting the contents to undefined is a bug and may crash the compiler.
This commit is contained in:
parent
622a3ac876
commit
18b46485bc
@ -232,7 +232,6 @@ pub const CObject = struct {
|
||||
pub fn destroy(em: *ErrorMsg, gpa: *Allocator) void {
|
||||
gpa.free(em.msg);
|
||||
gpa.destroy(em);
|
||||
em.* = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user