From 6cdac1bf7a17e239878b957da3f292a3e3de77d4 Mon Sep 17 00:00:00 2001 From: Daniel Milroy Date: Sat, 24 Feb 2024 18:58:13 -0800 Subject: [PATCH] testsuite: fix variable declaration for planner_multi unit tests Problem: planner_multi_t contexts are declared and initialized using a comma-separated list that can result in UB. Correct the declaration and initialization. --- resource/planner/test/planner_test02.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resource/planner/test/planner_test02.cpp b/resource/planner/test/planner_test02.cpp index c5ac053cc..76b42a420 100644 --- a/resource/planner/test/planner_test02.cpp +++ b/resource/planner/test/planner_test02.cpp @@ -556,9 +556,10 @@ static int test_constructors_and_overload () const uint64_t request1[] = {1, 0, 0, 0, 0}; const uint64_t request2[] = {0, 2, 0, 0, 0}; const uint64_t request3[] = {0, 0, 3, 0, 0}; - planner_multi_t *ctx, *ctx2, *ctx3, *ctx4 = NULL; + planner_multi_t *ctx = NULL, *ctx2 = NULL, *ctx3 = NULL, *ctx4 = NULL; - ctx = planner_multi_new (0, INT64_MAX, resource_totals, resource_types, len); + ctx = planner_multi_new (0, INT64_MAX, resource_totals, resource_types, + len); planner_multi_add_span (ctx, 0, 1000, request1, len); span = planner_multi_add_span (ctx, 1000, 1000, request2, len);