From: Seonah Moon Date: Tue, 12 Jul 2016 04:03:57 +0000 (+0900) Subject: [WGID-84174] Add null checking code to prevent null pointer exception X-Git-Tag: submit/tizen/20160712.074045^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2e4c8ccf99418b8204500e71e284fcff334aa4f;p=platform%2Fcore%2Fapi%2Fsoftap.git [WGID-84174] Add null checking code to prevent null pointer exception Change-Id: I47f07182d22c9b49813f17464d1700501a142b91 Signed-off-by: Seonah Moon --- diff --git a/packaging/capi-network-softap.spec b/packaging/capi-network-softap.spec index d594b7d..ca8f082 100644 --- a/packaging/capi-network-softap.spec +++ b/packaging/capi-network-softap.spec @@ -1,6 +1,6 @@ Name: capi-network-softap Summary: Softap Framework -Version: 0.0.6 +Version: 0.0.7 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/softap.c b/src/softap.c index d212eb5..18ddaee 100755 --- a/src/softap.c +++ b/src/softap.c @@ -704,6 +704,8 @@ static bool __get_ssid_from_vconf(const char *path, char *ssid, unsigned int siz API int softap_create(softap_h *softap) { DBG("+"); + _retvm_if(softap == NULL, SOFTAP_ERROR_INVALID_PARAMETER, + "parameter(softap) is NULL\n"); __softap_h *sa = NULL; GError *error = NULL; @@ -755,7 +757,8 @@ API int softap_create(softap_h *softap) NULL, SOFTAP_SERVICE_NAME, SOFTAP_SERVICE_OBJECT_PATH, SOFTAP_SERVICE_INTERFACE, sa->cancellable, &error); if (!sa->client_bus_proxy) { - ERR("Fail to create the proxy object because of %s", error->message); + if (error) + ERR("Fail to create the proxy object because of %s", error->message); g_cancellable_cancel(sa->cancellable); g_object_unref(sa->cancellable); free(sa); @@ -894,6 +897,8 @@ API int softap_is_enabled(softap_h softap, bool *enable) DBG("+"); _retvm_if(softap == NULL, SOFTAP_ERROR_INVALID_PARAMETER, "parameter(softap) is NULL"); + _retvm_if(enable == NULL, SOFTAP_ERROR_INVALID_PARAMETER, + "parameter(enable) is NULL"); int is_on = 0; int vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP;