From 4c65977854b135ad810d8e15f6b4b5103077f462 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Mon, 10 Jul 2017 22:49:35 -0700 Subject: [PATCH] Added protections to RenderScript VTS class teardown. If RenderScript HIDL server does not exist or cannot be opened, currently it results in a nullptr dereference when the VTS test is torn down. This CL adds a check before the cleanup. Test: mm -j40 Bug: 63711002 Change-Id: I11a226a78b31444e7b198b2ff1dfa3794963caa0 --- .../1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp index 2670b8d099..c6eecd6afd 100644 --- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp +++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp @@ -28,8 +28,10 @@ void RenderscriptHidlTest::SetUp() { } void RenderscriptHidlTest::TearDown() { - context->contextFinish(); - context->contextDestroy(); + if (context.get() != nullptr) { + context->contextFinish(); + context->contextDestroy(); + } } // A class for test environment setup (kept since this file is a template).