KW Warning fixes
Adding fixes for null reference errors. Change-Id: Ie62bd93860baef2670c164ae7a5d148440308213 CRs-Fixed: 2113171
This commit is contained in:
parent
6403989a5b
commit
7b37deedff
1 changed files with 17 additions and 0 deletions
|
@ -641,6 +641,10 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
|
|||
uint32_t* ids = NULL;
|
||||
if (count > 0) {
|
||||
ids = new uint32_t[count];
|
||||
if (ids == nullptr) {
|
||||
LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
|
||||
return nullptr;
|
||||
}
|
||||
for (size_t i=0; i < count; ++i) {
|
||||
ids[i] = generateSessionId();
|
||||
IF_LOC_LOGD {
|
||||
|
@ -678,6 +682,11 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
|
|||
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||
uint32_t index = 0;
|
||||
|
||||
if (errs == nullptr) {
|
||||
LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
|
||||
uint32_t newGpsLock = mAdapter.convertGpsLock(mConfig.gpsLock);
|
||||
ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
|
||||
|
@ -2146,6 +2155,10 @@ GnssAdapter::reportNmeaEvent(const char* nmea, size_t length, bool fromUlp)
|
|||
mAdapter(adapter),
|
||||
mNmea(new char[length+1]),
|
||||
mLength(length) {
|
||||
if (mNmea == nullptr) {
|
||||
LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
|
||||
return;
|
||||
}
|
||||
strlcpy((char*)mNmea, nmea, length+1);
|
||||
}
|
||||
inline virtual ~MsgReportNmea()
|
||||
|
@ -2737,6 +2750,10 @@ void GnssAdapter::dataConnOpenCommand(
|
|||
new char[apnLen + 1]), mApnLen(apnLen), mBearerType(bearerType) {
|
||||
|
||||
LOC_LOGV("AgpsMsgAtlOpenSuccess");
|
||||
if (mApnName == nullptr) {
|
||||
LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
|
||||
return;
|
||||
}
|
||||
memcpy(mApnName, apnName, apnLen);
|
||||
mApnName[apnLen] = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue