STHAL: Add null pointer check
Getting null pointer derefrence error while using param_payload pointer.
Add null check before using it.
Change-Id: I81776dfb69fcf2e69c68ddaf3f3ebbc89a90dd23
diff --git a/SoundTriggerSession.cpp b/SoundTriggerSession.cpp
index 62a15f6..1871502 100644
--- a/SoundTriggerSession.cpp
+++ b/SoundTriggerSession.cpp
@@ -691,7 +691,7 @@
status = pal_stream_get_param(pal_handle_,
PAL_PARAM_ID_WAKEUP_MODULE_VERSION, ¶m_payload);
- if (status) {
+ if (status || param_payload == NULL) {
ALOGE("%s: Failed to get version, status = %d", __func__, status);
goto exit;
}
@@ -709,6 +709,8 @@
}
pal_handle_ = nullptr;
}
+ if (param_payload != NULL)
+ delete param_payload;
ALOGV("%s: Exit", __func__);
return 0;
}