Fixed some svace issues 03/128503/1 accepted/tizen/unified/20170510.183717 submit/tizen/20170510.102153
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 10 May 2017 08:22:29 +0000 (17:22 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 10 May 2017 08:22:46 +0000 (17:22 +0900)
Change-Id: I0fc91a5bee205f2ecd40b6d130a5930e0f883bca
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
packaging/capi-network-stc.spec
src/internal/stc-event.c
src/stc-restriction.c
test/restriction.c

index f55a89185f82bc024c262003fd677396dc663783..228283144331c7a8c70e3b0a7b805250982113cc 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-network-stc
 Summary:    A Smart Traffic Control (STC) libraries in Native API
-Version:    0.0.1
+Version:    0.0.2
 Release:    1
 Group:      Network & Connectivity/API
 License:    Apache-2.0
index c94739e3bcd269ed09070dd3034183230c4451b0..419e56e7c2f5c6076efc81a32fe915663ab0c572 100755 (executable)
@@ -178,8 +178,11 @@ guint _stc_event_add_client_idle_cb(stc_event_info_s *event_data,
                return 0;
 
        data = g_try_new0(stc_event_info_s, 1);
-       if (!data)
+       if (!data) {
+               g_free(idle_data);
+               idle_data = NULL;
                return 0;
+       }
 
        memcpy(data, event_data, sizeof(stc_event_info_s));
 
index dccc15ef509be745c6deeb0de9aa2ed7cefa9ef5..3723ee26c990f58fc56b3f649ae5f72167d5a34a 100755 (executable)
@@ -435,28 +435,6 @@ stc_error_e _stc_restriction_validate_rule(
                "Invalid restriction network interface type [%s]",
                _stc_convert_iface_type_to_string(restriction_rule->iface_type));
 
-       if (rst_type == STC_RST_TYPE_SET) {
-               STC_RETURN_VAL_IF(restriction_rule->tx_limit < 0,
-                       STC_ERROR_INVALID_PARAMETER,
-                       "Invalid tx limit [%llu]",
-                       restriction_rule->tx_limit);
-
-               STC_RETURN_VAL_IF(restriction_rule->rx_limit < 0,
-                       STC_ERROR_INVALID_PARAMETER,
-                       "Invalid rx limit [%llu]",
-                       restriction_rule->rx_limit);
-
-               STC_RETURN_VAL_IF(restriction_rule->tx_warning_limit < 0,
-                       STC_ERROR_INVALID_PARAMETER,
-                       "Invalid tx warning limit [%llu]",
-                       restriction_rule->tx_warning_limit);
-
-               STC_RETURN_VAL_IF(restriction_rule->rx_warning_limit < 0,
-                       STC_ERROR_INVALID_PARAMETER,
-                       "Invalid rx warning limit [%llu]",
-                       restriction_rule->rx_warning_limit);
-       }
-
        STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
                restriction_rule->roaming_type > STC_ROAMING_DISABLED,
                STC_ERROR_INVALID_PARAMETER,
@@ -485,26 +463,6 @@ stc_error_e _stc_restriction_check_set_rule(
                "Invalid restriction network interface type [%s]",
                _stc_convert_iface_type_to_string(restriction_rule->iface_type));
 
-       STC_RETURN_VAL_IF(restriction_rule->tx_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid tx limit [%llu]",
-               restriction_rule->tx_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->rx_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid rx limit [%llu]",
-               restriction_rule->rx_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->tx_warning_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid tx warning limit [%llu]",
-               restriction_rule->tx_warning_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->rx_warning_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid rx warning limit [%llu]",
-               restriction_rule->rx_warning_limit);
-
        STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
                restriction_rule->roaming_type > STC_ROAMING_DISABLED,
                STC_ERROR_INVALID_PARAMETER,
@@ -599,26 +557,6 @@ stc_error_e _stc_restriction_check_remove_rule(
                "Invalid restriction network interface type [%d]",
                restriction_rule->iface_type);
 
-       STC_RETURN_VAL_IF(restriction_rule->tx_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid tx limit [%llu]",
-               restriction_rule->tx_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->rx_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid rx limit [%llu]",
-               restriction_rule->rx_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->tx_warning_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid tx warning limit [%llu]",
-               restriction_rule->tx_warning_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->rx_warning_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid rx warning limit [%llu]",
-               restriction_rule->rx_warning_limit);
-
        STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
                restriction_rule->roaming_type > STC_ROAMING_DISABLED,
                STC_ERROR_INVALID_PARAMETER,
@@ -651,26 +589,6 @@ stc_error_e _stc_restriction_check_exclude_rule(
                "Invalid restriction network interface type [%d]",
                restriction_rule->iface_type);
 
-       STC_RETURN_VAL_IF(restriction_rule->tx_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid tx limit [%llu]",
-               restriction_rule->tx_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->rx_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid rx limit [%llu]",
-               restriction_rule->rx_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->tx_warning_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid tx warning limit [%llu]",
-               restriction_rule->tx_warning_limit);
-
-       STC_RETURN_VAL_IF(restriction_rule->rx_warning_limit < 0,
-               STC_ERROR_INVALID_PARAMETER,
-               "Invalid rx warning limit [%llu]",
-               restriction_rule->rx_warning_limit);
-
        STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
                restriction_rule->roaming_type > STC_ROAMING_DISABLED,
                STC_ERROR_INVALID_PARAMETER,
index 205af3c59d0a96cae909ace59422428290cb2aed..6c04c16f6ebd5c7e5323eadffbf19bbb3434e062 100755 (executable)
@@ -186,8 +186,7 @@ static int __test_stc_set_restriction_rule(MManager *mm, struct menu_data *menu)
                return ret;
        }
 
-       if ((rx_limit >= 0 && rx_limit < G_MAXUINT64) &&
-               (tx_limit >= 0 && tx_limit < G_MAXUINT64)) {
+       if ((rx_limit < G_MAXUINT64) && (tx_limit < G_MAXUINT64)) {
                ret = stc_restriction_rule_set_limit(g_restriction_rule,
                                        rx_limit, tx_limit);
                if (ret == STC_ERROR_NONE)
@@ -199,8 +198,7 @@ static int __test_stc_set_restriction_rule(MManager *mm, struct menu_data *menu)
                }
        }
 
-       if ((rx_warning_limit >= 0 && rx_warning_limit < G_MAXUINT64) &&
-               (tx_warning_limit >= 0 && tx_warning_limit < G_MAXUINT64)) {
+       if ((rx_warning_limit < G_MAXUINT64) && (tx_warning_limit < G_MAXUINT64)) {
                ret = stc_restriction_rule_set_warning_limit(g_restriction_rule,
                                        rx_warning_limit, tx_warning_limit);
                if (ret == STC_ERROR_NONE)