~mil/mepo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH mepo] Plug some leaks in async shell pipe

Details
Message ID
<20240605030207.15051-1-cnx@loang.net>
DKIM signature
pass
Download raw message
Patch: +2 -1
---
 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
Details
Message ID
<8c1adea3-8d98-4a73-91e7-666dfe02474c@app.fastmail.com>
In-Reply-To
<20240605030207.15051-1-cnx@loang.net> (view parent)
DKIM signature
pass
Download raw message
On Tue, Jun 4, 2024, at 11:02 PM, Nguyễn Gia Phong wrote:
> ---
>  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

Very nice catch. Thanks for sending - applied!
Reply to thread Export thread (mbox)