1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-02 16:43:28 +00:00

Fixed memory leak that occurs if agent is shutdown while spawned processes are still open.

This commit is contained in:
Bryan Roe
2020-12-03 18:20:11 -08:00
parent 0b835a6c82
commit fa4b217943
3 changed files with 26 additions and 1 deletions

View File

@@ -169,7 +169,21 @@ duk_ret_t ILibDuktape_ChildProcess_Kill(duk_context *ctx)
duk_push_this(ctx);
ILibDuktape_ChildProcess_SubProcess *p = (ILibDuktape_ChildProcess_SubProcess*)Duktape_GetBufferProperty(ctx, -1, ILibDuktape_ChildProcess_MemBuf);
if (p != NULL) { ILibProcessPipe_Process_SoftKill(p->childProcess); }
if (p != NULL)
{
//printf("CTX shutting down: %d [%p]\n", duk_ctx_shutting_down(ctx), p->childProcess);
if (p->childProcess != NULL)
{
if (duk_ctx_shutting_down(ctx) == 0)
{
ILibProcessPipe_Process_SoftKill(p->childProcess);
}
else
{
ILibProcessPipe_Process_HardKill(p->childProcess);
}
}
}
return(0);
}
duk_ret_t ILibDuktape_ChildProcess_waitExit(duk_context *ctx)