From 222094ce77cc7a711f6e5af57bbd9fef473ae6ec Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Fri, 28 Apr 2017 16:31:43 -0700 Subject: [PATCH] Prevent print of uninitialized string If uninitialized string gets printed, this can cause a crash. Bug: 37218688 CRs-fixed: 2032144 Change-Id: I7c34b6f84f414410c52fc59f73053892060b0874 --- android/Gnss.cpp | 2 +- location/LocationAPI.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/Gnss.cpp b/android/Gnss.cpp index 9a362f0a..9b2e7ddc 100644 --- a/android/Gnss.cpp +++ b/android/Gnss.cpp @@ -85,7 +85,7 @@ GnssInterface* Gnss::getGnssInterface() { if (nullptr == mGnssInterface && !getGnssInterfaceFailed) { LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__); getLocationInterface* getter = NULL; - const char *error; + const char *error = NULL; dlerror(); void *handle = dlopen("libgnss.so", RTLD_NOW); if (NULL == handle || (error = dlerror()) != NULL) { diff --git a/location/LocationAPI.cpp b/location/LocationAPI.cpp index 3086adc1..60a46fe5 100644 --- a/location/LocationAPI.cpp +++ b/location/LocationAPI.cpp @@ -82,7 +82,7 @@ static void* loadLocationInterface(const char* library, const char* name) { return NULL; } getLocationInterface* getter = NULL; - const char *error; + const char *error = NULL; dlerror(); void *handle = dlopen(library, RTLD_NOW); if (NULL == handle || (error = dlerror()) != NULL) {