diff options
author | JinWang An <jinwang.an@samsung.com> | 2022-09-19 17:08:47 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2022-09-19 17:08:47 +0900 |
commit | 98fe623416969240242386d5f03db880ff468739 (patch) | |
tree | 674e24308a1d28658b68bfebeb4b52bce9bb6f81 | |
parent | a849528aec830c97947d11c1851b3d5e335d8fd3 (diff) | |
download | watch-setting-98fe623416969240242386d5f03db880ff468739.tar.gz watch-setting-98fe623416969240242386d5f03db880ff468739.tar.bz2 watch-setting-98fe623416969240242386d5f03db880ff468739.zip |
Fix memory leak about calling xmlGetProp()tizen_7.0_m2_releaseaccepted/tizen/unified/20220920.110711accepted/tizen/7.0/unified/hotfix/20221116.112124accepted/tizen/7.0/unified/20221110.061210tizen_7.0_hotfixtizen_7.0accepted/tizen_unifiedaccepted/tizen_7.0_unified_hotfixaccepted/tizen_7.0_unified
Change-Id: I31cc4c08cedcd26f050e317beadb56ae3ba0150e
Signed-off-by: JinWang An <jinwang.an@samsung.com>
-rw-r--r-- | src/setting-language.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/setting-language.c b/src/setting-language.c index 7789d47..1b3e810 100644 --- a/src/setting-language.c +++ b/src/setting-language.c @@ -536,8 +536,10 @@ static void _tree_walk_langlist(xmlNodePtr cur) for (cur_node = cur; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { - id = (char *)g_strdup((char *)xmlGetProp(cur_node, (const xmlChar *)"id")); - name = (char *)g_strdup((char *)xmlGetProp(cur_node, (const xmlChar *)"string")); + xmlChar *xml_id = xmlGetProp(cur_node, (const xmlChar *)"id"); + xmlChar *xml_name = xmlGetProp(cur_node, (const xmlChar *)"string"); + id = (char *)g_strdup((char *)xml_id); + name = (char *)g_strdup((char *)xml_name); struct _lang_menu_item *pitem = (struct _lang_menu_item *)calloc(1, sizeof(struct _lang_menu_item)); if (pitem) { @@ -554,6 +556,8 @@ static void _tree_walk_langlist(xmlNodePtr cur) } FREE(id); FREE(name); + xmlFree(xml_id); + xmlFree(xml_name); } } } |