Fix the coverity issues 83/281883/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.063037 accepted/tizen/7.0/unified/hotfix/20221116.105854 accepted/tizen/unified/20220923.125158 tizen_7.0_m2_release
authorWootak Jung <wootak.jung@samsung.com>
Fri, 23 Sep 2022 01:38:18 +0000 (10:38 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 23 Sep 2022 01:38:30 +0000 (10:38 +0900)
Change-Id: I206b77d68d9eab9bd3034315e57c4acff13d3f01
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/network_name/manager_network_name.c

index 996f94e6f4d51bf6bd3593fd71e6eac771ee4ce8..2c72ea31c840f6a45e90b321d335efc1762808cf 100644 (file)
@@ -1363,7 +1363,10 @@ void manager_network_load_spn_override_info(NetworkPrivateInfo *npi)
        for (cur_node = cur; cur_node; cur_node = cur_node->next) {
                if (cur_node->type == XML_ELEMENT_NODE) {
                        xml_plmn = (char *)xmlGetProp(cur_node, (const xmlChar *)"numeric");
-                       if (xml_plmn && !g_strcmp0(xml_plmn, imsi->plmn)) {
+                       if (!xml_plmn)
+                               continue;
+
+                       if (!g_strcmp0(xml_plmn, imsi->plmn)) {
                                xml_spn = (char *)xmlGetProp(cur_node, (const xmlChar *)"spn");
                                xml_imsi_subset = (char *)xmlGetProp(cur_node, (const xmlChar *)"imsi_subset");
                                xml_fake_home_on = (char *)xmlGetProp(cur_node, (const xmlChar *)"fake_home_on");
@@ -1379,11 +1382,17 @@ void manager_network_load_spn_override_info(NetworkPrivateInfo *npi)
                                                key_matched = TRUE;
                                                g_free(npi->eons_data->spn_override_info->imsi_subset);
                                                npi->eons_data->spn_override_info->imsi_subset = g_strdup(xml_imsi_subset);
+                                               xmlFree(xml_imsi_subset);
                                        } else {
                                                info("[SPN_OVERRIDE] is not matched. check another field");
+                                               if (xml_plmn) xmlFree(xml_plmn);
+                                               if (xml_spn) xmlFree(xml_spn);
+                                               if (xml_imsi_subset) xmlFree(xml_imsi_subset);
+                                               if (xml_fake_home_on) xmlFree(xml_fake_home_on);
+                                               if (xml_fake_roaming_on) xmlFree(xml_fake_roaming_on);
+                                               if (xml_spn_display_rule) xmlFree(xml_spn_display_rule);
                                                continue;
                                        }
-                                       xmlFree(xml_imsi_subset);
                                } else {
                                        info("[SPN_OVERRIDE] We don't need to check key matching. This is candidate info");
                                }
@@ -1412,12 +1421,13 @@ void manager_network_load_spn_override_info(NetworkPrivateInfo *npi)
                                        xmlFree(xml_spn_display_rule);
                                }
 
-                               if (key_matched)
+                               if (key_matched) {
+                                       xmlFree(xml_plmn);
                                        break;
+                               }
                        }
 
-                       if (xml_plmn)
-                               xmlFree(xml_plmn);
+                       xmlFree(xml_plmn);
                }
        }