From: Sangyoon Jang Date: Thu, 25 Oct 2018 04:38:05 +0000 (+0900) Subject: Fix allocating structure object X-Git-Tag: submit/submit/tizen/20190214.065356/20190214.070335~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91d0f8d96118e277df59f431c08d30856c3927db;p=platform%2Fcore%2Fapi%2Fcapability-manager.git Fix allocating structure object Use "new A()" style to zero initialize. Change-Id: I1baf86c4b8e8130ba81a7b7e10107eb5681f8faf Signed-off-by: Sangyoon Jang --- diff --git a/src/client.cc b/src/client.cc index a2f05c3..b01f4ee 100644 --- a/src/client.cc +++ b/src/client.cc @@ -88,7 +88,7 @@ API int capmgr_device_clone(const capmgr_device_h device, return CAPMGR_ERROR_INVALID_PARAMETER; try { - struct capmgr_device_s* clone = new struct capmgr_device_s; + struct capmgr_device_s* clone = new struct capmgr_device_s(); clone->device_id = device->device_id; clone->model_name = device->model_name; @@ -191,7 +191,7 @@ API int capmgr_app_control_create(capmgr_app_control_h* app_control) { return CAPMGR_ERROR_INVALID_PARAMETER; try { - struct capmgr_app_control_s* control = new struct capmgr_app_control_s; + struct capmgr_app_control_s* control = new struct capmgr_app_control_s(); control->b = bundle_create(); if (!control->b) { delete control; @@ -218,7 +218,7 @@ API int capmgr_app_control_clone(const capmgr_app_control_h app_control, return CAPMGR_ERROR_INVALID_PARAMETER; try { - struct capmgr_app_control_s* clone = new struct capmgr_app_control_s; + struct capmgr_app_control_s* clone = new struct capmgr_app_control_s(); int ret = capmgr_device_clone(app_control->device, &clone->device); if (ret != CAPMGR_ERROR_NONE) { @@ -468,7 +468,7 @@ void capmgr_dbus_callback(GVariant* result, void* user_data) { g_variant_iter_free(iter); struct cbdata* cbdata = reinterpret_cast(user_data); - struct capmgr_app_control_s* reply = new struct capmgr_app_control_s; + struct capmgr_app_control_s* reply = new struct capmgr_app_control_s(); reply->b = bundle_decode(data, len); if (!reply->b) { LOG(ERROR) << "Invalid bundle data!"; @@ -520,7 +520,7 @@ API int capmgr_app_control_send(capmgr_app_control_h app_control, return r; } - struct cbdata* cbdata = new struct cbdata; + struct cbdata* cbdata = new struct cbdata(); cbdata->request = clone; cbdata->cb = cb; cbdata->user_data = user_data; diff --git a/src/dbus.cc b/src/dbus.cc index 8b3c3f1..ec092d9 100644 --- a/src/dbus.cc +++ b/src/dbus.cc @@ -129,7 +129,7 @@ bool ProxyCallAsync(const char* method, GVariant* params, DBusCallback cb, } // will be freed at MethodCallback() - struct cbdata* cbdata = new struct cbdata; + struct cbdata* cbdata = new struct cbdata(); cbdata->cb = cb; cbdata->user_data = user_data;