Skip to content

Commit

Permalink
Fix xmpp_stanza_release() for cloned child-stanzas.
Browse files Browse the repository at this point in the history
Break the linked-list of children before releasing a child.

Before this patch it was possible, when a child is cloned and stored
for longer than the lifetime of its parent, that its `next` pointer
points to invalid memory that was already free'd when the parent stanza
was released.

This issue exists already since the initial version of
`xmpp_stanza_release()`.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
  • Loading branch information
sjaeckel committed Jul 27, 2023
1 parent ad8969e commit 60c714b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/stanza.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ int xmpp_stanza_release(xmpp_stanza_t *stanza)
while (child) {
tchild = child;
child = child->next;
tchild->next = NULL;
xmpp_stanza_release(tchild);
}

Expand Down

0 comments on commit 60c714b

Please sign in to comment.