possible NULL pointer dereference

it appears some of the MsgTask msgs might fail
to create, ending up with a NULL pointer, in
which case when it gets received, dereferencing
a NULL pointer will happen, causing crash.

Change-Id: I5a4295b4fba9c8383754e2abe6558782b1b83143
CRs-Fixed: 1106034
This commit is contained in:
Kevin Tang 2017-01-09 18:53:54 -08:00 committed by Gerrit - the friendly Code Review server
parent 681388fa8d
commit 5253a74c6b

View file

@ -73,7 +73,11 @@ void MsgTask::destroy() {
}
void MsgTask::sendMsg(const LocMsg* msg) const {
msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
if (msg) {
msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
} else {
LOC_LOGE("%s: msg is NULL", __func__);
}
}
void MsgTask::prerun() {