[Tarantool-patches] [PATCH v2 2/2] xrow: reset parameters of decode_subscribe() to default

Serge Petrenko sergepetrenko at tarantool.org
Thu Sep 2 16:21:34 MSK 2021


Nullify all the output parameters passed to xrow_decode_subscribe().

This should help us get rid of cases when some of the parameters were
left uninitialized when the SUBSCRIBE request didn't contain the
corresponding fields.

Follow-up #6034
---
 src/box/xrow.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/box/xrow.c b/src/box/xrow.c
index 7df1af4ab..3cad2c1be 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -1561,10 +1561,19 @@ xrow_decode_subscribe(struct xrow_header *row, struct tt_uuid *replicaset_uuid,
 		return -1;
 	}
 
-	if (anon)
+	if (replicaset_uuid != NULL)
+		*replicaset_uuid = uuid_nil;
+	if (instance_uuid != NULL)
+		*instance_uuid = uuid_nil;
+	if (vclock != NULL)
+		vclock_create(vclock);
+	if (version_id != NULL)
+		*version_id = 0;
+	if (anon != NULL)
 		*anon = false;
-	if (id_filter)
+	if (id_filter != NULL)
 		*id_filter = 0;
+
 	d = data;
 	uint32_t map_size = mp_decode_map(&d);
 	for (uint32_t i = 0; i < map_size; i++) {
-- 
2.30.1 (Apple Git-130)



More information about the Tarantool-patches mailing list