Skip to content

Commit

Permalink
[presence_dialoginfo] Fix aggregating dialoginfo XML
Browse files Browse the repository at this point in the history
Fix the looping when aggregating the dialog info XML documents with multiple dialog elements. The xmlUnlinkNode() function inside the loop is breaking the looping (the "next" member is reset).
Credits for reporting and fixing go to Damien Sandras (@dsandras)
Closes #2815

(cherry picked from commit 0cca86f)
(cherry picked from commit 4bc9d96)
  • Loading branch information
bogdan-iancu committed May 2, 2022
1 parent ac20213 commit 1a71fde
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/presence_dialoginfo/notify_body.c
Expand Up @@ -109,14 +109,13 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n
str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, int partial)
{
int i, j= 0;

xmlDocPtr doc = NULL;
xmlNodePtr root_node = NULL;
xmlNsPtr namespace = NULL;

xmlNodePtr p_root= NULL;
xmlDocPtr* xml_array ;
xmlNodePtr node = NULL;
xmlNodePtr next_node = NULL;
char *state;
int winner_priority = -1, priority ;
xmlNodePtr winner_dialog_node = NULL ;
Expand Down Expand Up @@ -211,7 +210,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in
goto error;
}
if (p_root->children) {
for (node = p_root->children; node; node = node->next) {
for (node = p_root->children; node; node = next_node) {
next_node = node->next;
if (node->type == XML_ELEMENT_NODE) {
LM_DBG("node type: Element, name: %s\n", node->name);
/* we do not copy the node, but unlink it and then add it ot the new node
Expand Down

0 comments on commit 1a71fde

Please sign in to comment.