mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-15 15:53:55 +00:00
1. Fixed minor memory leaks
2. Updated child_process.waitExit() to throw an exception if it's aborted
This commit is contained in:
@@ -174,6 +174,7 @@ duk_ret_t ILibDuktape_ChildProcess_Kill(duk_context *ctx)
|
||||
}
|
||||
duk_ret_t ILibDuktape_ChildProcess_waitExit(duk_context *ctx)
|
||||
{
|
||||
printf("==> WaitExit() [ENTER]\n");
|
||||
int timeout = duk_is_number(ctx, 0) ? duk_require_int(ctx, 0) : -1;
|
||||
void *chain = Duktape_GetChain(ctx);
|
||||
if (ILibIsChainBeingDestroyed(chain))
|
||||
@@ -201,7 +202,10 @@ duk_ret_t ILibDuktape_ChildProcess_waitExit(duk_context *ctx)
|
||||
#else
|
||||
ILibChain_Continue(chain, (ILibChain_Link**)mods, 3, timeout);
|
||||
#endif
|
||||
|
||||
if (ILibIsChainBeingDestroyed(chain) != 0)
|
||||
{
|
||||
return(ILibDuktape_Error(ctx, "waitExit() aborted because thread is exiting"));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
duk_ret_t ILibDuktape_ChildProcess_SpawnedProcess_Finalizer(duk_context *ctx)
|
||||
|
||||
@@ -1812,6 +1812,7 @@ void ILibDuktape_fs_notifyDispatcher_PostSelect(void* object, int slct, fd_set *
|
||||
}
|
||||
void ILibDuktape_fs_notifyDispatcher_Destroy(void *object)
|
||||
{
|
||||
ILibHashtable_Destroy(((ILibDuktape_fs_linuxWatcher*)object)->watchTable);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -854,9 +854,9 @@ __EXPORT_TYPE char* ILibSimpleDataStore_GetHashEx(ILibSimpleDataStore dataStore,
|
||||
memcpy_s(tmpkey, ILibMemory_Size(tmpkey), key, keyLen);
|
||||
((uint32_t*)(tmpkey + keyLen))[0] = crc32c(0, (unsigned char*)key, (uint32_t)keyLen); // no dataloss, capped to INT32_MAX
|
||||
centry = (ILibSimpleDataStore_CacheEntry*)ILibHashtable_Get(root->cacheTable, NULL, tmpkey, (int)ILibMemory_Size(tmpkey));
|
||||
ILibMemory_Free(tmpkey);
|
||||
if (centry != NULL)
|
||||
{
|
||||
ILibMemory_Free(tmpkey);
|
||||
return(centry->valueHash);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user