Module: kamailio
Branch: master
Commit: ff712539566c903312ebba2f8e2585f9c80ffdcf
URL: 
https://github.com/kamailio/kamailio/commit/ff712539566c903312ebba2f8e2585f9c80ffdcf

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-02-13T09:40:00+01:00

xmlrpc: clean allocated buffer

---

Modified: src/modules/xmlrpc/xmlrpc.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/ff712539566c903312ebba2f8e2585f9c80ffdcf.diff
Patch: 
https://github.com/kamailio/kamailio/commit/ff712539566c903312ebba2f8e2585f9c80ffdcf.patch

---

diff --git a/src/modules/xmlrpc/xmlrpc.c b/src/modules/xmlrpc/xmlrpc.c
index 4157e94904d..eb44f4450dd 100644
--- a/src/modules/xmlrpc/xmlrpc.c
+++ b/src/modules/xmlrpc/xmlrpc.c
@@ -2024,7 +2024,7 @@ static int rpc_struct_printf(
                struct rpc_struct *s, char *member_name, char *fmt, ...)
 {
        int n, buf_size;
-       char *buf;
+       char *buf = NULL;
        va_list ap;
        str st, name;
        struct xmlrpc_reply *reply;
@@ -2076,6 +2076,7 @@ static int rpc_struct_printf(
                        if(add_xmlrpc_reply(out, &member_suffix) < 0)
                                goto err;
 
+                       mxr_free(buf);
                        return 0;
                }
                /* Else try again with more space. */
@@ -2090,6 +2091,8 @@ static int rpc_struct_printf(
                        goto err;
                }
        }
+       if(buf)
+               mxr_free(buf);
        return 0;
 err:
        if(buf)
@@ -2745,7 +2748,7 @@ static int ki_xmlrpc_reply(sip_msg_t *msg, int rcode, str 
*reason)
                if(add_xmlrpc_reply(&reply, &int_suffix) < 0)
                        goto error;
                if(add_xmlrpc_reply(&reply, &success_suffix) < 0)
-                       return -1;
+                       goto error;
        }
        if(send_reply(msg, &reply.body) < 0)
                goto error;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to