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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user