From f3cfc6833bd2d866537f938238d4c90004c6f52a Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Wed, 28 Mar 2018 11:17:00 +0900 Subject: [PATCH] Fix Coverity issues - sensor_is_supported() has a return value, int type. In tilt-sensor-impl-tizen.cpp, there is an omitted return check code at 146 line. So, added to check the return value of sensor_is_supported. - Fixed to memory leak in clipboard-impl-ecore-wl. Variable 'reply' is allocated from 'eldbus_proxy_send_and_block()' So, added to eldbus_message_unref(reply) for memory free. Change-Id: I9a389508430d3b209e886f3dc83e7898350b92e0 Signed-off-by: Seoyeon Kim --- dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp | 6 ++++++ dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp b/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp index 4580e66..821a730 100644 --- a/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp +++ b/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp @@ -162,6 +162,10 @@ struct Clipboard::Impl DALI_LOG_ERROR("Unable to call method org.freedesktop.DBus.Properties.Get: %s %s", errname, errmsg); eldbus_message_unref(req); + if( reply ) + { + eldbus_message_unref(reply); + } return -1; } @@ -169,10 +173,12 @@ struct Clipboard::Impl { DALI_LOG_ERROR("Cannot get arguments from eldbus"); eldbus_message_unref(req); + eldbus_message_unref(reply); return -1; } eldbus_message_unref(req); + eldbus_message_unref(reply); DALI_LOG_ERROR("cbhm item count(%d)", count); return count; } diff --git a/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp b/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp index d2d76ca..0681148 100644 --- a/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp +++ b/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp @@ -143,7 +143,13 @@ bool TiltSensorTizen::Connect() { DALI_LOG_ERROR("sensor does not support SENSOR_ORIENTATION\n"); - sensor_is_supported(SENSOR_ACCELEROMETER, &isSupported); + ret = sensor_is_supported(SENSOR_ACCELEROMETER, &isSupported); + + if(ret < 0) + { + DALI_LOG_ERROR("sensor_is_supported() failed : %s\n", get_sensor_error_string(ret).c_str()); + return false; + } if(isSupported == false) { -- 2.7.4