Module: kamailio
Branch: master
Commit: b54573ca9167c807a1de39634bed04cb7953dce0
URL:
https://github.com/kamailio/kamailio/commit/b54573ca9167c807a1de39634bed04c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-09-20T14:25:31+02:00
xmlrpc: reset fields in case of error for building fake via
---
Modified: src/modules/xmlrpc/http.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b54573ca9167c807a1de39634bed04c…
Patch:
https://github.com/kamailio/kamailio/commit/b54573ca9167c807a1de39634bed04c…
---
diff --git a/src/modules/xmlrpc/http.c b/src/modules/xmlrpc/http.c
index 04e1cd06eb..81fb6df9b7 100644
--- a/src/modules/xmlrpc/http.c
+++ b/src/modules/xmlrpc/http.c
@@ -67,6 +67,7 @@ static int insert_fake_via(sip_msg_t* msg, char* via, int via_len)
LM_ERR("out of pkg memory\n");
goto error;
}
+ memset(vb, 0, sizeof(struct via_body));
msg->h_via1 = pkg_malloc(sizeof(hdr_field_t));
if (!msg->h_via1) {
@@ -74,7 +75,6 @@ static int insert_fake_via(sip_msg_t* msg, char* via, int via_len)
goto error;
}
memset(msg->h_via1, 0, sizeof(hdr_field_t));
- memset(vb, 0, sizeof(struct via_body));
/* FIXME: The code below would break if the VIA prefix
* gets changed in config.h
@@ -121,10 +121,12 @@ static int insert_fake_via(sip_msg_t* msg, char* via, int via_len)
error:
if (vb) {
free_via_list(vb);
- pkg_free(vb);
}
- if (msg->h_via1) pkg_free(msg->h_via1);
+ if (msg->h_via1) {
+ pkg_free(msg->h_via1);
+ msg->h_via1 = 0;
+ }
return -1;
}