Fixed loads of memory leaks and related issues.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3782 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-01-22 18:50:29 +00:00
parent d470d6c398
commit 0f03701043
5 changed files with 57 additions and 21 deletions

View File

@ -270,6 +270,8 @@ static bool _serialize_storeInternal(tf_task_t* task, tf_taskstub_t* to, buffer_
if (JS_GetOwnProperty(tf_task_get_context(task), &desc, value, ptab[i].atom) == 1)
{
key_value = desc.value;
JS_FreeValue(tf_task_get_context(task), desc.setter);
JS_FreeValue(tf_task_get_context(task), desc.getter);
}
_serialize_storeInternal(task, to, buffer, key, depth + 1);
_serialize_storeInternal(task, to, buffer, key_value, depth + 1);
@ -297,6 +299,8 @@ static bool _serialize_storeInternal(tf_task_t* task, tf_taskstub_t* to, buffer_
if (JS_GetOwnProperty(tf_task_get_context(task), &desc, value, ptab[i].atom) == 1)
{
key_value = desc.value;
JS_FreeValue(tf_task_get_context(task), desc.setter);
JS_FreeValue(tf_task_get_context(task), desc.getter);
}
_serialize_storeInternal(task, to, buffer, key, depth + 1);
_serialize_storeInternal(task, to, buffer, key_value, depth + 1);
@ -325,7 +329,7 @@ static JSValue _serialize_load(tf_task_t* task, tf_taskstub_t* from, const char*
static JSValue _serialize_loadInternal(tf_task_t* task, tf_taskstub_t* from, const char** buffer, size_t* size, int depth)
{
if (*size < sizeof(size))
if (*size < sizeof(int32_t))
{
return JS_UNDEFINED;
}