From a9ee765c49bd9c605b678d001289d444801017d7 Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Tue, 31 Mar 2026 18:56:02 +0300 Subject: [PATCH] fix: memory leak and crash when id is NULL in iq_id_handler_add (upstream 0218ba26) --- src/xmpp/iq.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 613c27ce..ec1ede7c 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -358,6 +358,13 @@ _iq_id_handler_free(ProfIqHandler* handler) void iq_id_handler_add(const char* const id, ProfIqCallback func, ProfIqFreeCallback free_func, void* userdata) { + if (id == NULL) { + if (free_func) { + free_func(userdata); + } + return; + } + ProfIqHandler* handler = malloc(sizeof(ProfIqHandler)); if (handler) { handler->func = func;