From aa1c104cbbf5a79efac1ef97c645c2c2bf8d6c4e Mon Sep 17 00:00:00 2001 From: hyunuktak Date: Wed, 19 Sep 2018 09:56:19 +0900 Subject: [PATCH] Fixed svace issues for dereference null return value Change-Id: I05984b387f22b6b2a9b90fef9d5a11f3b36f8ef4 Signed-off-by: hyunuktak --- src/stc-restriction.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/stc-restriction.c b/src/stc-restriction.c index 3ba77fc..e83cef3 100755 --- a/src/stc-restriction.c +++ b/src/stc-restriction.c @@ -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); -- 2.34.1