summaryrefslogtreecommitdiff
path: root/src/user-awareness-monitors.c
diff options
context:
space:
mode:
authorsaerome.kim <saerome.kim@samsung.com>2019-08-26 17:57:21 +0900
committersaerome.kim <saerome.kim@samsung.com>2019-08-26 20:00:23 +0900
commit5324a11e7b2da759fee3d933d9c5ec16f6d3eefe (patch)
treef3c5b653207e05a5a96c170d7e54c85a810fe412 /src/user-awareness-monitors.c
parentf4f275dba6fb017771001c3e500ca8bc30198075 (diff)
downloaduser-awareness-5324a11e7b2da759fee3d933d9c5ec16f6d3eefe.tar.gz
user-awareness-5324a11e7b2da759fee3d933d9c5ec16f6d3eefe.tar.bz2
user-awareness-5324a11e7b2da759fee3d933d9c5ec16f6d3eefe.zip
Fixed the Coverity & Svace issues.
1078724 Leaked_storage: Variable mac going out of scope leaks the storage it points to. 1078723 copy_paste_error: g_presence_and_cond looks like a copy-paste error. 1078720 Check return: Calling ua_device_get_mac_address without checking return value. 1078717 Check_return:Calling ua_device_get_mac_type without checking return value. 1076181 Leaked_storage: Variable service going out of scope leaks the storage it points to. 1076152 Leaked_storage: Variable service going out of scope leaks the storage it points to. 405915 Leaked_storage: Variable mac going out of scope leaks the storage it points to Change-Id: I1c8d80568c0df9901abcdc0c26a5318b7faa3a6b Signed-off-by: saerome.kim <saerome.kim@samsung.com>
Diffstat (limited to 'src/user-awareness-monitors.c')
-rw-r--r--src/user-awareness-monitors.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/user-awareness-monitors.c b/src/user-awareness-monitors.c
index 7e9dd35..5a0b317 100644
--- a/src/user-awareness-monitors.c
+++ b/src/user-awareness-monitors.c
@@ -698,6 +698,8 @@ int ua_monitor_start_presence_detection(
monitor->user_data = user_data;
monitor->presence_detection_started = TRUE;
+ g_free(service);
+
FUNC_EXIT;
return UA_ERROR_NONE;
}
@@ -729,8 +731,10 @@ int ua_monitor_start_absence_detection(
if (monitor->service)
if ((service && g_strcmp0(monitor->service, service)) ||
- (!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT)))
+ (!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT))) {
+ g_free(service);
return UA_ERROR_NOT_PERMITTED;
+ }
retv_if(UA_DETECT_MODE_INVALID <= mode, UA_ERROR_INVALID_PARAMETER);
retv_if(0 == monitor->sensor_bitmask, UA_ERROR_NO_DATA);
@@ -767,6 +771,8 @@ int ua_monitor_start_absence_detection(
monitor->user_data = user_data;
monitor->absence_detection_started = TRUE;
+ g_free(service);
+
FUNC_EXIT;
return UA_ERROR_NONE;
}