fix qjs memory leak

This commit is contained in:
ekibun
2020-10-03 23:36:39 +08:00
parent 8a72bac6a9
commit d294dd59bc
13 changed files with 125 additions and 84 deletions

View File

@@ -3,7 +3,7 @@
* @Author: ekibun
* @Date: 2020-09-06 18:32:45
* @LastEditors: ekibun
* @LastEditTime: 2020-09-24 22:32:15
* @LastEditTime: 2020-10-03 23:26:14
*/
#include "ffi.h"
#include <functional>
@@ -226,7 +226,7 @@ extern "C"
}
DLLEXPORT int32_t jsDefinePropertyValue(JSContext *ctx, JSValueConst *this_obj,
JSAtom prop, JSValue *val, int32_t flags)
JSAtom prop, JSValue *val, int32_t flags)
{
return JS_DefinePropertyValue(ctx, *this_obj, prop, *val, flags);
}
@@ -247,7 +247,7 @@ extern "C"
}
DLLEXPORT int32_t jsGetOwnPropertyNames(JSContext *ctx, JSPropertyEnum **ptab,
uint32_t *plen, JSValueConst *obj, int32_t flags)
uint32_t *plen, JSValueConst *obj, int32_t flags)
{
return JS_GetOwnPropertyNames(ctx, ptab, plen, *obj, flags);
}
@@ -259,7 +259,7 @@ extern "C"
DLLEXPORT uint32_t sizeOfJSValue()
{
return sizeof (JSValue);
return sizeof(JSValue);
}
DLLEXPORT void setJSValueList(JSValue *list, uint32_t i, JSValue *val)
@@ -293,4 +293,9 @@ extern "C"
{
return new JSValue(JS_NewPromiseCapability(ctx, resolving_funcs));
}
DLLEXPORT void jsFree(JSContext *ctx, void *ptab)
{
js_free(ctx, ptab);
}
}

View File

@@ -106,4 +106,6 @@ extern "C"
DLLEXPORT int32_t jsExecutePendingJob(JSRuntime *rt);
DLLEXPORT JSValue *jsNewPromiseCapability(JSContext *ctx, JSValue *resolving_funcs);
DLLEXPORT void jsFree(JSContext *ctx, void *ptab);
}