Commit 18b46485bc

LemonBoy <thatlemon@gmail.com>
2021-05-05 10:46:21
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.
1 parent 622a3ac
Changed files (1)
src/Compilation.zig
@@ -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;
         }
     };