From: Cheoleun Moon Date: Thu, 25 Jun 2020 09:42:14 +0000 (+0900) Subject: Free before return X-Git-Tag: accepted/tizen/5.5/unified/20200629.130308^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=664157d35cd3f6a2e9f9dc501b7a3f94b66c2f25;p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git Free before return Change-Id: I951213a634605c561d9061c45134c6d7ef924d67 --- diff --git a/src/stc-manager-util.c b/src/stc-manager-util.c index 1f25927..3e77610 100755 --- a/src/stc-manager-util.c +++ b/src/stc-manager-util.c @@ -182,4 +182,5 @@ void stc_util_initialize_config(void) } __save_key_file(keyfile, path); + g_key_file_free(keyfile); } diff --git a/src/stc-pcap.c b/src/stc-pcap.c index 3faa7ec..29f5037 100755 --- a/src/stc-pcap.c +++ b/src/stc-pcap.c @@ -106,6 +106,7 @@ gboolean handle_pcap_start(StcPcap *object, if (__validate_pcap(&pcap) == FALSE) { STC_PCAP_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE STC_ERROR_INVALID_PARAMETER); + g_free(pcap.ifname); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } @@ -113,11 +114,13 @@ gboolean handle_pcap_start(StcPcap *object, ret = stc_plugin_pcap_register_loop(pcap.ifname, pcap.nflog_group); if (ret != STC_ERROR_NONE) { STC_PCAP_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE + g_free(pcap.ifname); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } STC_DBUS_REPLY_ERROR_NONE(invocation); + g_free(pcap.ifname); __STC_LOG_FUNC_EXIT__; return TRUE; } @@ -147,6 +150,7 @@ gboolean handle_pcap_stop(StcPcap *object, if (__validate_pcap(&pcap) == FALSE) { STC_PCAP_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE STC_ERROR_INVALID_PARAMETER); + g_free(pcap.ifname); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } @@ -154,11 +158,13 @@ gboolean handle_pcap_stop(StcPcap *object, ret = stc_plugin_pcap_unregister_loop(pcap.ifname, pcap.nflog_group); if (ret != STC_ERROR_NONE) { STC_PCAP_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE + g_free(pcap.ifname); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } STC_DBUS_REPLY_ERROR_NONE(invocation); + g_free(pcap.ifname); __STC_LOG_FUNC_EXIT__; return TRUE; } diff --git a/src/stc-restriction.c b/src/stc-restriction.c index d47aaf0..47bfee8 100755 --- a/src/stc-restriction.c +++ b/src/stc-restriction.c @@ -259,6 +259,14 @@ static void __stc_extract_restriction_rule(const char *key, GVariant *value, } } +static void __stc_free_restriction_rule_members(table_restrictions_info *rule) +{ + FREE(rule->app_id); + FREE(rule->ifname); + FREE(rule->subscriber_id); + FREE(rule->mac); +} + gboolean handle_restriction_set(StcRestriction *object, GDBusMethodInvocation *invocation, GVariant *parameters, @@ -285,6 +293,7 @@ gboolean handle_restriction_set(StcRestriction *object, if (__validate_rstn_rule(&rule) == FALSE) { STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE STC_ERROR_INVALID_PARAMETER); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } @@ -293,12 +302,14 @@ gboolean handle_restriction_set(StcRestriction *object, if (ret != STC_ERROR_NONE) { STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE STC_ERROR_DB_FAILED); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } stc_plugin_monitor_add_rstn(&rule); STC_DBUS_REPLY_ERROR_NONE(invocation); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; return TRUE; } @@ -329,6 +340,7 @@ gboolean handle_restriction_unset(StcRestriction *object, if (__validate_rstn_rule(&rule) == FALSE) { STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE STC_ERROR_INVALID_PARAMETER); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } @@ -338,12 +350,14 @@ gboolean handle_restriction_unset(StcRestriction *object, if (ret != STC_ERROR_NONE) { STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE STC_ERROR_DB_FAILED); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } stc_plugin_monitor_remove_rstn(&rule); STC_DBUS_REPLY_ERROR_NONE(invocation); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; return TRUE; } @@ -376,6 +390,7 @@ gboolean handle_restriction_set_list(StcRestriction *object, STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE g_variant_iter_free(iter_row); g_variant_iter_free(iter); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } @@ -385,11 +400,13 @@ gboolean handle_restriction_set_list(StcRestriction *object, STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE g_variant_iter_free(iter_row); g_variant_iter_free(iter); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } } + __stc_free_restriction_rule_members(&rule); g_variant_iter_free(iter_row); } g_variant_iter_free(iter); @@ -428,6 +445,7 @@ gboolean handle_restriction_unset_list(StcRestriction *object, STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE g_variant_iter_free(iter_row); g_variant_iter_free(iter); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } @@ -437,11 +455,13 @@ gboolean handle_restriction_unset_list(StcRestriction *object, STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE g_variant_iter_free(iter_row); g_variant_iter_free(iter); + __stc_free_restriction_rule_members(&rule); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; } } + __stc_free_restriction_rule_members(&rule); g_variant_iter_free(iter_row); } g_variant_iter_free(iter); diff --git a/src/stc-statistics.c b/src/stc-statistics.c index a0b5a07..feee566 100755 --- a/src/stc-statistics.c +++ b/src/stc-statistics.c @@ -360,6 +360,7 @@ gboolean handle_statistics_get(StcStatistics *object, if (ret < STC_ERROR_NONE) { g_variant_builder_unref(builder); //LCOV_EXCL_LINE STC_STATISTICS_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE + g_free(rule.app_id); __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE return TRUE; //LCOV_EXCL_LINE } @@ -370,6 +371,7 @@ gboolean handle_statistics_get(StcStatistics *object, DEBUG_GDBUS_VARIANT("Return parameters: ", return_parameters); STC_DBUS_REPLY(invocation, return_parameters); + g_free(rule.app_id); __STC_LOG_FUNC_EXIT__; return TRUE; }