Commit fd7a97b3b2

Andrew Kelley <andrew@ziglang.org>
2020-06-24 22:20:02
fix memory leak of anonymous decl name
1 parent e42b770
Changed files (1)
src-self-hosted
src-self-hosted/Module.zig
@@ -2378,6 +2378,7 @@ fn createAnonymousDecl(
     const name_index = self.getNextAnonNameIndex();
     const scope_decl = scope.decl().?;
     const name = try std.fmt.allocPrint(self.allocator, "{}${}", .{ scope_decl.name, name_index });
+    defer self.allocator.free(name);
     const name_hash = scope.namespace().fullyQualifiedNameHash(name);
     const src_hash: std.zig.SrcHash = undefined;
     const new_decl = try self.createNewDecl(scope, name, scope_decl.src_index, name_hash, src_hash);