~mil/mepo-devel

mepo: Plug some leaks in async shell pipe v1 APPLIED

Nguyễn Gia Phong: 1
 Plug some leaks in async shell pipe

 1 files changed, 2 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/mepo-devel/patches/53136/mbox | git am -3
Learn more about email & git

[PATCH mepo] Plug some leaks in async shell pipe Export this patch

---
 src/api/shellpipe_async.zig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/api/shellpipe_async.zig b/src/api/shellpipe_async.zig
index 63c919a0caeb..a7487fa37b27 100644
--- a/src/api/shellpipe_async.zig
+++ b/src/api/shellpipe_async.zig
@@ -34,11 +34,12 @@ fn async_shellpipe(mepo: *Mepo, unique_handle_id: i8, cmd: []const u8) !void {
    sp_req.unique_handle_id = unique_handle_id;
    sp_req.cmd = try mepo.allocator.dupeZ(u8, cmd);
    sp_req.mepo = mepo;
    _ = sdl.SDL_CreateThread(async_shellpipe_run, "async_shellpipe", sp_req);
    sdl.SDL_DetachThread(sdl.SDL_CreateThread(async_shellpipe_run, "async_shellpipe", sp_req));
}

fn async_shellpipe_run(userdata: ?*anyopaque) callconv(.C) c_int {
    const shellpipe_request: *AsyncShellpipeRequest = @alignCast(@ptrCast(userdata.?));
    defer shellpipe_request.mepo.allocator.destroy(shellpipe_request);
    async_shellpipe_run_catch_errors(shellpipe_request.mepo, shellpipe_request.unique_handle_id, shellpipe_request.cmd) catch |err| {
        utildbg.log("Error running async shellpipe: {}\n", .{err});
    };
-- 
2.41.0