From 6ed3fcbfb02b4328a8cfdaeaba4ee99e73c93e76 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 20 Aug 2023 19:40:35 -0700 Subject: [PATCH] terminal/kitty-gfx: fix big chunked load memory leak --- src/terminal/kitty/graphics_exec.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/terminal/kitty/graphics_exec.zig b/src/terminal/kitty/graphics_exec.zig index 115e26e96..b1e237456 100644 --- a/src/terminal/kitty/graphics_exec.zig +++ b/src/terminal/kitty/graphics_exec.zig @@ -204,8 +204,9 @@ fn loadAndAddImage( // Determine our image. This also handles chunking and early exit. var img = if (storage.chunk) |chunk| img: { + // Note: we do NOT want to call "cmd.toOwnedData" here because + // we're _copying_ the data. We want the command data to be freed. try chunk.data.appendSlice(alloc, cmd.data); - _ = cmd.toOwnedData(); // If we have more then we're done if (t.more_chunks) return chunk.image;