{"action":"closed","issue":{"url":"https://api.github.com/repos/CESNET/libnetconf/issues/168","repository_url":"https://api.github.com/repos/CESNET/libnetconf","labels_url":"https://api.github.com/repos/CESNET/libnetconf/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/CESNET/libnetconf/issues/168/comments","events_url":"https://api.github.com/repos/CESNET/libnetconf/issues/168/events","html_url":"https://github.com/CESNET/libnetconf/issues/168","id":139481325,"number":168,"title":"Question about edit_merge_lists() ","user":{"login":"classcwnd","id":3356405,"avatar_url":"https://avatars.githubusercontent.com/u/3356405?v=3","gravatar_id":"","url":"https://api.github.com/users/classcwnd","html_url":"https://github.com/classcwnd","followers_url":"https://api.github.com/users/classcwnd/followers","following_url":"https://api.github.com/users/classcwnd/following{/other_user}","gists_url":"https://api.github.com/users/classcwnd/gists{/gist_id}","starred_url":"https://api.github.com/users/classcwnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/classcwnd/subscriptions","organizations_url":"https://api.github.com/users/classcwnd/orgs","repos_url":"https://api.github.com/users/classcwnd/repos","events_url":"https://api.github.com/users/classcwnd/events{/privacy}","received_events_url":"https://api.github.com/users/classcwnd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-09T05:42:47Z","updated_at":"2016-03-09T09:39:16Z","closed_at":"2016-03-09T09:39:16Z","body":"Hi,\r\n\r\nI think following code in ```edit_merge_list()``` has problem. ```merge_code``` shall be added directly without ```xmlCopyNode()```, otherwise there shall be memory leak, because ```merge_code``` is not released at all.\r\n\r\n```\r\nif (refnode != NULL) {\r\n\t/* relink th node before the currently first instance of the list */\r\n\txmlAddPrevSibling(refnode, xmlCopyNode(merged_node, 1));\r\n} else {\r\n\t/* re-link the node as last node since there is currently no instance of the list */\r\n\txmlAddChild(parent, xmlCopyNode(merged_node, 1));\r\n}\r\n```\r\n\r\nshall be\r\n```\r\nif (refnode != NULL) {\r\n\t/* relink th node before the currently first instance of the list */\r\n\txmlAddPrevSibling(refnode, merged_node);\r\n} else {\r\n\t/* re-link the node as last node since there is currently no instance of the list */\r\n\txmlAddChild(parent, merged_node);\r\n}\r\n```"}}