fix: correct zarray single-pointer convention in build_host_eval_ctx; add num_res guard
This commit is contained in:
parent
907d8d80a3
commit
2e3469c3c5
2 changed files with 11 additions and 10 deletions
|
|
@ -85,12 +85,11 @@ test_build_host_eval_ctx_float(void)
|
|||
|
||||
xce_val_t v;
|
||||
memset(&v, 0, sizeof(v));
|
||||
v.which = 5; /* Value_u_fvalue */
|
||||
v.which = Value_u_fvalue;
|
||||
v.u.fvalue = 4.0;
|
||||
|
||||
/* zarray stores xce_val_t* items; pass pointer-to-pointer */
|
||||
xce_val_t* vp = &v;
|
||||
zarray_put(&w.resvals, 2, &vp);
|
||||
/* store xce_val_t* directly, matching production put_resvals behavior */
|
||||
zarray_put(&w.resvals, 2, &v);
|
||||
|
||||
host_eval_ctx_t* ctx = build_host_eval_ctx(&w, 3);
|
||||
TEST_ASSERT_NOT_NULL(ctx);
|
||||
|
|
@ -99,9 +98,7 @@ test_build_host_eval_ctx_float(void)
|
|||
TEST_ASSERT_NULL(ctx->strvals[2]);
|
||||
TEST_ASSERT_EQUAL_INT(3, ctx->num_res);
|
||||
|
||||
free((void*)ctx->numvals);
|
||||
free((void*)ctx->strvals);
|
||||
free(ctx);
|
||||
free_host_eval_ctx(ctx);
|
||||
zarray_fini(&w.resvals);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue