Skip to content

Commit

Permalink
testsuite: fix variable declaration for planner_multi unit tests
Browse files Browse the repository at this point in the history
Problem: planner_multi_t contexts are declared and initialized using a
comma-separated list that can result in UB.

Correct the declaration and initialization.
  • Loading branch information
milroy committed Feb 25, 2024
1 parent 386a12e commit 6cdac1b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resource/planner/test/planner_test02.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6cdac1b

Please sign in to comment.