1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-07 11:03:55 +00:00

Added missing Canary checks, and altered engine_free to wipe memory

This commit is contained in:
Bryan Roe
2019-02-01 13:02:14 -08:00
parent bd16538a8e
commit e9f8626be8
3 changed files with 14 additions and 5 deletions

View File

@@ -154,7 +154,7 @@ void ILibDuktape_EventEmitter_FinalizerEx(ILibHashtable sender, void *Key1, char
int ILibDuktape_EventEmitter_HasListeners(ILibDuktape_EventEmitter *emitter, char *eventName)
{
int retVal = 0;
if(emitter!=NULL && emitter->eventTable != NULL)
if(ILibMemory_CanaryOK(emitter) && emitter!=NULL && emitter->eventTable != NULL && emitter->ctx != NULL)
{
ILibLinkedList eventList = ILibHashtable_Get(emitter->eventTable, NULL, eventName, (int)strnlen_s(eventName, 255));
if (eventList != NULL)
@@ -191,7 +191,7 @@ duk_ret_t ILibDuktape_EventEmitter_emit(duk_context *ctx)
self = duk_get_heapptr(ctx, -1);
duk_pop(ctx); // ...
if (data->eventTable == NULL || data->ctx == NULL) { duk_push_false(ctx); return(1); } // This probably means the finalizer was already run on the eventEmitter
if(!ILibMemory_CanaryOK(data) || data->eventTable == NULL || data->ctx == NULL) { duk_push_false(ctx); return(1); } // This probably means the finalizer was already run on the eventEmitter
eventList = ILibHashtable_Get(data->eventTable, NULL, name, (int)nameLen);
if (eventList == NULL)