diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2017-11-29 11:26:59 -0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2017-11-30 11:10:49 -0800 |
commit | 198be80793a2b1f17b8a2b828da4368d79a25951 (patch) | |
tree | 17daeb421957544a37e14ac14dbec06afd42b3af /test | |
parent | 4c9a6385e852765f9187d1ab91bba8904a6129fb (diff) | |
download | libva-intel-driver-198be80793a2b1f17b8a2b828da4368d79a25951.tar.gz |
test: add null check assertions to object_heap tests
Ensure objects are not NULL before dereferencing.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/object_heap_test.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/object_heap_test.cpp b/test/object_heap_test.cpp index 89fd8d78..97a1c929 100644 --- a/test/object_heap_test.cpp +++ b/test/object_heap_test.cpp @@ -187,8 +187,10 @@ TEST(ObjectHeapTest, DataIntegrity) int id = object_heap_allocate(&heap); object_base_p base = object_heap_lookup(&heap, id); test_object_p object = (test_object_p)base; - object->i = std::rand(); - values.push_back(object->i); + if (object) { + object->i = std::rand(); + values.push_back(object->i); + } return object; }; @@ -198,7 +200,9 @@ TEST(ObjectHeapTest, DataIntegrity) ASSERT_EQ(objects.size(), values.size()); auto validator = [&](test_object_p object) { + ASSERT_TRUE(object != NULL); object_base_p base = object_heap_lookup(&heap, object->base.id); + ASSERT_TRUE(base != NULL); EXPECT_TRUE(&object->base == base); EXPECT_EQ(object->base.id, base->id); test_object_p lo = (test_object_p)base; |