diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2018-03-13 11:50:46 +0900 |
---|---|---|
committer | Seonah Moon <seonah1.moon@samsung.com> | 2018-03-13 13:21:56 +0900 |
commit | 881ae10993c6f11a05cad6f92a2f07c5f06494e0 (patch) | |
tree | 7acf9509f6d569bbba543480f48e6e1e5c1f563d | |
parent | 8ab955dc8f20b00b148b665e687e14ec20587087 (diff) | |
download | net-popup-881ae10993c6f11a05cad6f92a2f07c5f06494e0.tar.gz net-popup-881ae10993c6f11a05cad6f92a2f07c5f06494e0.tar.bz2 net-popup-881ae10993c6f11a05cad6f92a2f07c5f06494e0.zip |
Fix resource leaksubmit/tizen/20180320.043504submit/tizen/20180318.231541accepted/tizen/unified/20180320.141347
CID-110047
Change-Id: I4dc702929473a004ca5025ddeb1d5703f5b34c94
-rwxr-xr-x | src/net-popup.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/net-popup.c b/src/net-popup.c index 9020dd9..9d64598 100755 --- a/src/net-popup.c +++ b/src/net-popup.c @@ -229,35 +229,49 @@ void __net_popup_send_data_usage_msg(const char *app_id, ret = stc_initialize(&stc); if (ret != STC_ERROR_NONE) { - log_print(NET_POPUP, "Failed to get operation ret= %d\n", ret); - return; + log_print(NET_POPUP, "Failed to initialize ret= %d\n", ret); + goto DONE; } ret = stc_restriction_rule_create(stc, &rule); if (ret != STC_ERROR_NONE) { log_print(NET_POPUP, "Failed to create restriction rule ret= %d\n", ret); - return; + goto DONE; } ret = stc_restriction_rule_set_app_id(rule, app_id); if (ret != STC_ERROR_NONE) { log_print(NET_POPUP, "Failed to set application ID ret= %d\n", ret); - return; + goto DONE; } ret = stc_restriction_rule_set_iface_type(rule, iftype[0] - '0'); if (ret != STC_ERROR_NONE) { log_print(NET_POPUP, "Failed to set interface type ret= %d\n", ret); - return; + goto DONE; } ret = stc_unset_restriction(stc, rule); if (ret != STC_ERROR_NONE) { log_print(NET_POPUP, "Failed to unset restriction ret= %d\n", ret); - return; + goto DONE; } log_print(NET_POPUP, "Success to unset restriction\n"); + +DONE: + if (rule) { + ret = stc_restriction_rule_destroy(rule); + if (ret != STC_ERROR_NONE) + log_print(NET_POPUP, "Failed to destroy restriction rule ret= %d\n", ret); + } + + if (stc) { + ret = stc_deinitialize(stc); + if (ret != STC_ERROR_NONE) + log_print(NET_POPUP, "Failed to deinitialize ret= %d\n", ret); + } + return; } @@ -1833,6 +1847,9 @@ error: if (noti != NULL) notification_free(noti); + + if (service_handle) + app_control_destroy(service_handle); } static void __net_popup_del_found_ap_noti(void) |