Skip to content
Snippets Groups Projects
Commit 7e0d751e authored by VitaliyaIoffe's avatar VitaliyaIoffe Committed by Kirill Yukhin
Browse files

build: fix uninitialized variables

Build for Fedora 34 is breaking out due to uninitialized variables in
 a few places:
 For example,
 [100%] Built target merger.test
/source/build/usr/src/debug/tarantool-2.9.0.116/src/box/sql.c: In function 'tarantoolSqlNextSeqId':
/source/build/usr/src/debug/tarantool-2.9.0.116/src/box/sql.c:1186:13: error: 'key' may be used uninitialized [-Werror=maybe-uninitialized]
 1186 |         if (box_index_max(BOX_SEQUENCE_ID, 0 /* PK */, key,

Needed for: #6074
parent 1575f3c0
No related branches found
No related tags found
No related merge requests found
......@@ -1180,9 +1180,10 @@ sql_debug_info(struct info_handler *h)
int
tarantoolSqlNextSeqId(uint64_t *max_id)
{
char key[16];
char key[1];
struct tuple *tuple;
char *key_end = mp_encode_array(key, 0);
assert(key_end - key == 1);
if (box_index_max(BOX_SEQUENCE_ID, 0 /* PK */, key,
key_end, &tuple) != 0)
return -1;
......
......@@ -259,6 +259,7 @@ test_return_mp(box_function_ctx_t *ctx, const char *args, const char *args_end)
(void) args;
(void) args_end;
char buf[512];
memset(buf, '\0', 512);
char *pos = mp_encode_uint(buf, 1);
int rc = box_return_mp(ctx, buf, pos);
if (rc != 0)
......
......@@ -14,6 +14,7 @@ ret_bin(box_function_ctx_t *ctx, const char *args, const char *args_end)
(void)args_end;
const char bin[] = "some varbinary string";
char res[BUF_SIZE];
memset(res, '\0', BUF_SIZE);
char *end = mp_encode_bin(res, bin, sizeof(bin));
box_return_mp(ctx, res, end);
return 0;
......@@ -27,6 +28,7 @@ ret_uuid(box_function_ctx_t *ctx, const char *args, const char *args_end)
struct tt_uuid uuid;
memset(&uuid, 0x11, sizeof(uuid));
char res[BUF_SIZE];
memset(res, '\0', BUF_SIZE);
char *end = mp_encode_uuid(res, &uuid);
box_return_mp(ctx, res, end);
return 0;
......@@ -40,6 +42,7 @@ ret_decimal(box_function_ctx_t *ctx, const char *args, const char *args_end)
decimal_t dec;
decimal_from_string(&dec, "9999999999999999999.9999999999999999999");
char res[BUF_SIZE];
memset(res, '\0', BUF_SIZE);
char *end = mp_encode_decimal(res, &dec);
box_return_mp(ctx, res, end);
return 0;
......
......@@ -27,6 +27,7 @@ is_uuid(box_function_ctx_t *ctx, const char *args, const char *args_end)
}
char res[BUF_SIZE];
memset(res, '\0', BUF_SIZE);
char *end = mp_encode_bool(res, is_uuid);
box_return_mp(ctx, res, end);
return 0;
......@@ -40,6 +41,7 @@ ret_uuid(box_function_ctx_t *ctx, const char *args, const char *args_end)
struct tt_uuid uuid;
memset(&uuid, 0x11, sizeof(uuid));
char res[BUF_SIZE];
memset(res, '\0', BUF_SIZE);
char *end = mp_encode_uuid(res, &uuid);
box_return_mp(ctx, res, end);
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment