From 8cf201ae2ad75a5292e322f12daec5b5ba6d029b Mon Sep 17 00:00:00 2001 From: Saurabh Srivastava Date: Mon, 3 Jul 2017 17:07:37 +0530 Subject: [PATCH] Adding KW warning fixes Change-Id: I03a09abdfc4224d59d3ddb467d0314e644fe4fe0 CRs-Fixed: 2062522 --- gnss/GnssAdapter.cpp | 4 ++-- location/LocationAPIClientBase.cpp | 32 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 3d5f7d2c..d08f8c2d 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -1096,7 +1096,7 @@ GnssAdapter::requestCapabilitiesCommand(LocationAPI* client) return; } - LocationCapabilitiesMask mask = {}; + LocationCapabilitiesMask mask = 0; // time based tracking always supported mask |= LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT; if (mApi.isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)){ @@ -2741,7 +2741,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector& out, } // extract each sv info from systemstatus report - for(uint32_t i=0; i sessionsVec = mGeofenceBiDict.getAllSessions(); size_t count = sessionsVec.size(); uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count); + if (sessions == NULL) { + LOC_LOGE("%s:%d] Failed to allocate %d bytes !", + __FUNCTION__, __LINE__, sizeof(uint32_t) * count); + return; + } if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) { size_t j = 0; @@ -747,6 +772,13 @@ void LocationAPIClientBase::beforeGeofenceBreachCb( size_t n = geofenceBreachNotification.count; geofenceBreachCallback genfenceCallback = nullptr; + if (ids == NULL) { + LOC_LOGE("%s:%d] Failed to alloc %d bytes", + __FUNCTION__, __LINE__, + sizeof(uint32_t) * geofenceBreachNotification.count); + return; + } + pthread_mutex_lock(&mMutex); if (mGeofenceBreachCallback != nullptr) { size_t count = 0;