Fixed svace issues for dereference null return value 71/189571/1 accepted/tizen/5.0/unified/20181102.013304 accepted/tizen/unified/20180919.142039 submit/tizen/20180919.090201 submit/tizen_5.0/20181101.000002
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 19 Sep 2018 00:56:19 +0000 (09:56 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 19 Sep 2018 00:56:21 +0000 (09:56 +0900)
Change-Id: I05984b387f22b6b2a9b90fef9d5a11f3b36f8ef4
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
src/stc-restriction.c

index 3ba77fc..e83cef3 100755 (executable)
@@ -288,15 +288,15 @@ static void __stc_restriction_get_per_app_id_reply(
                if (iter != NULL) {
                        restriction_rule = g_try_malloc0(
                                sizeof(stc_restriction_rule_s));
+                       if (restriction_rule) {
+                               _stc_dbus_dictionary_foreach(iter,
+                                       __stc_restriction_extract_rule_cb, restriction_rule);
 
-                       _stc_dbus_dictionary_foreach(iter,
-                               __stc_restriction_extract_rule_cb, restriction_rule);
-
-                       __stc_restriction_print_rule(restriction_rule);
-
-                       restriction_list = g_slist_append(restriction_list,
-                               (stc_restriction_rule_s *)restriction_rule);
+                               __stc_restriction_print_rule(restriction_rule);
 
+                               restriction_list = g_slist_append(restriction_list,
+                                       (stc_restriction_rule_s *)restriction_rule);
+                       }
                        g_variant_iter_free(iter);
                }
 
@@ -347,15 +347,15 @@ static void __stc_restriction_get_all_reply(
                while (g_variant_iter_next(iter, "a{sv}", &iter_row)) {
                        restriction_rule = g_try_malloc0(
                                sizeof(stc_restriction_rule_s));
+                       if (restriction_rule) {
+                               _stc_dbus_dictionary_foreach(iter_row,
+                                       __stc_restriction_extract_rule_cb, restriction_rule);
 
-                       _stc_dbus_dictionary_foreach(iter_row,
-                               __stc_restriction_extract_rule_cb, restriction_rule);
-
-                       __stc_restriction_print_rule(restriction_rule);
-
-                       restriction_list = g_slist_append(restriction_list,
-                               (stc_restriction_rule_s *)restriction_rule);
+                               __stc_restriction_print_rule(restriction_rule);
 
+                               restriction_list = g_slist_append(restriction_list,
+                                       (stc_restriction_rule_s *)restriction_rule);
+                       }
                        g_variant_iter_free(iter_row);
                }
                g_variant_iter_free(iter);