Fix allocating structure object
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 25 Oct 2018 04:38:05 +0000 (13:38 +0900)
committer장상윤/Tizen Platform Lab(SR)/Engineer/삼성전자 <jeremy.jang@samsung.com>
Thu, 25 Oct 2018 06:59:17 +0000 (15:59 +0900)
Use "new A()" style to zero initialize.

Change-Id: I1baf86c4b8e8130ba81a7b7e10107eb5681f8faf
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/client.cc
src/dbus.cc

index a2f05c3..b01f4ee 100644 (file)
@@ -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<struct cbdata*>(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;
index 8b3c3f1..ec092d9 100644 (file)
@@ -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;