From 88d8e605117271a915040d5ef7678eeecc8d644e Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 12 Mar 2024 21:44:20 -0400 Subject: [PATCH] Some minor paranoia to appease valgrind. --- src/file.js.c | 1 + src/ssb.rpc.c | 3 +-- src/util.js.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/file.js.c b/src/file.js.c index 238c1e3e8..a49a325f9 100644 --- a/src/file.js.c +++ b/src/file.js.c @@ -234,6 +234,7 @@ static JSValue _file_read_file(JSContext* context, JSValueConst this_val, int ar }, .size = k_file_read_max, }; + memset(req + 1, 0, k_file_read_max); int result = uv_fs_open(tf_task_get_loop(task), &req->fs, file_name, UV_FS_O_RDONLY, 0, _file_read_open_callback); if (result < 0) { diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index a08e32fbd..eea4b5c3b 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -30,8 +30,7 @@ static int64_t _get_global_setting_int64(tf_ssb_t* ssb, const char* name, int64_ { if (sqlite3_bind_text(statement, 1, name, -1, NULL) == SQLITE_OK) { - if (sqlite3_step(statement) == SQLITE_ROW && - sqlite3_column_type(statement, 0) != SQLITE_NULL) + if (sqlite3_step(statement) == SQLITE_ROW && sqlite3_column_type(statement, 0) != SQLITE_NULL) { result = sqlite3_column_int64(statement, 0); } diff --git a/src/util.js.c b/src/util.js.c index 9d345c906..83d93906c 100644 --- a/src/util.js.c +++ b/src/util.js.c @@ -46,10 +46,10 @@ static JSValue _util_utf8_decode(JSContext* context, JSValueConst this_val, int } else { - size_t offset; - size_t element_size; + size_t offset = 0; + size_t element_size = 0; JSValue buffer = tf_util_try_get_typed_array_buffer(context, argv[0], &offset, &length, &element_size); - size_t size; + size_t size = 0; if (!JS_IsException(buffer)) { array = tf_util_try_get_array_buffer(context, &size, buffer);