test/json_util_ut: assert that string is valid
Make sure the output.my_name pointer is not NULL before calling memcmp() on it. Fixes static analysis warning about a potential NULL pointer dereference. Change-Id: I85faf57c63b0760c4f90d9ee99f6d7e3df121211 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/369264 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
cb29ce869f
commit
2c28fa5426
@ -175,6 +175,7 @@ test_decode_object(void)
|
||||
|
||||
/* Passing Test: object containing simple types */
|
||||
CU_ASSERT(spdk_json_decode_object(object, decoders, 4, &output) == 0);
|
||||
SPDK_CU_ASSERT_FATAL(output.my_name != NULL);
|
||||
CU_ASSERT(memcmp(output.my_name, answer_str, 6) == 0);
|
||||
CU_ASSERT(output.my_int == answer);
|
||||
CU_ASSERT(output.my_bool == answer_bool);
|
||||
|
Loading…
Reference in New Issue
Block a user