Commit 2f37278540

Jakub Konka <kubkon@jakubkonka.com>
2022-10-23 10:15:42
macho: temp hash buffer has to live as long as pread error resolution
1 parent 1bbafbc
Changed files (1)
src
src/link/MachO/CodeSignature.zig
@@ -289,12 +289,12 @@ pub fn writeAdhocSignature(
     // Calculate hash for each page (in file) and write it to the buffer
     var wg: WaitGroup = .{};
     {
+        const buffer = try gpa.alloc(u8, self.page_size * total_pages);
+        defer gpa.free(buffer);
+
         const results = try gpa.alloc(fs.File.PReadError!usize, total_pages);
         defer gpa.free(results);
         {
-            const buffer = try gpa.alloc(u8, self.page_size * total_pages);
-            defer gpa.free(buffer);
-
             wg.reset();
             defer wg.wait();