From a5f9f927e66baba3e9dfd5cb6545f2a761399627 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 8 Feb 2023 01:50:47 +0000 Subject: [PATCH] Fix some memory leaks I just introduced. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4173 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.c | 1 + src/ssb.js.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/ssb.c b/src/ssb.c index 13bc999a..48a0997f 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2331,6 +2331,7 @@ void tf_ssb_destroy(tf_ssb_t* ssb) { sqlite3_close(ssb->db_readers[i]); } + tf_free(ssb->db_readers); uv_mutex_destroy(&ssb->db_readers_lock); tf_free((void*)ssb->db_path); tf_free(ssb); diff --git a/src/ssb.js.c b/src/ssb.js.c index 0569e678..9f47b204 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -516,6 +516,8 @@ static void _tf_ssb_sqlAsync_after_work(uv_work_t* work, int status) tf_util_report_error(context, result); JS_FreeValue(context, sql_work->promise[0]); JS_FreeValue(context, sql_work->promise[1]); + JS_FreeValue(context, sql_work->callback); + JS_FreeCString(context, sql_work->query); tf_free(sql_work); } @@ -585,7 +587,9 @@ static JSValue _tf_ssb_sqlAsync(JSContext* context, JSValueConst this_val, int a tf_util_report_error(context, result); JS_FreeValue(context, work->promise[0]); JS_FreeValue(context, work->promise[1]); + JS_FreeValue(context, work->callback); JS_FreeValue(context, error); + JS_FreeCString(context, query); tf_free(work->binds); tf_free(work); }