Codec2Client: avoid a null pointer deref
Not 100% sure of the correctness of this fix, since I'm not super
familiar with this codebase; the static analyzer flagged `*syncObj`
below as a potential nullptr dereference, since we check for its
nullness below.
Bug: 157111613
Test: TreeHugger
Change-Id: I14817e97a70bf9ce0275885483a719bb1d0b4975
diff --git a/media/codec2/hidl/client/output.cpp b/media/codec2/hidl/client/output.cpp
index 283ed8d..8cd4934 100644
--- a/media/codec2/hidl/client/output.cpp
+++ b/media/codec2/hidl/client/output.cpp
@@ -222,7 +222,7 @@
if (generation == mGeneration) {
// case of old BlockPool destruction
C2SyncVariables *var = mSyncMem ? mSyncMem->mem() : nullptr;
- if (var) {
+ if (syncObj && var) {
*syncObj = std::make_shared<V1_2::SurfaceSyncObj>();
(*syncObj)->bqId = bqId;
(*syncObj)->syncMemory = mSyncMem->handle();