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:
LemonBoy 2021-05-05 10:46:21 +02:00 committed by Andrew Kelley
parent 622a3ac876
commit 18b46485bc

View File

@ -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;
}
};