Module: sip-router
Branch: master
Commit: dc453ac1e9d631c417b1b9c70d7b9d92107b389f
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dc453ac…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 19 13:29:44 2011 +0200
parser: switch pkg_free(tob) to free_to(tob) to free To header structure
- this takes care of freeing parameters in case of paring error of
To-like headers
- patch by Walter Doekes, closes FS#155
---
lib/kcore/parse_pai.c | 2 +-
lib/kcore/parse_ppi.c | 2 +-
modules/sanity/sanity.c | 2 +-
modules_k/seas/encode_header.c | 2 +-
parser/msg_parser.c | 4 ++--
parser/parse_diversion.c | 2 +-
parser/parse_from.c | 2 +-
parser/parse_refer_to.c | 2 +-
parser/parse_rpid.c | 2 +-
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/kcore/parse_pai.c b/lib/kcore/parse_pai.c
index 5cd580f..d0dda3d 100644
--- a/lib/kcore/parse_pai.c
+++ b/lib/kcore/parse_pai.c
@@ -66,7 +66,7 @@ int parse_pai_header( struct sip_msg *msg )
parse_to(msg->pai->body.s, msg->pai->body.s + msg->pai->body.len+1,
pai_b);
if (pai_b->error == PARSE_ERROR) {
LM_ERR("bad P-Asserted-Identity header\n");
- pkg_free(pai_b);
+ free_to(pai_b);
goto error;
}
msg->pai->parsed = pai_b;
diff --git a/lib/kcore/parse_ppi.c b/lib/kcore/parse_ppi.c
index 5857709..4dc9ec8 100644
--- a/lib/kcore/parse_ppi.c
+++ b/lib/kcore/parse_ppi.c
@@ -74,7 +74,7 @@ int parse_ppi_header( struct sip_msg *msg )
ppi_b);
if (ppi_b->error == PARSE_ERROR) {
LM_ERR("bad P-Preferred-Identity header\n");
- pkg_free(ppi_b);
+ free_to(ppi_b);
goto error;
}
msg->ppi->parsed = ppi_b;
diff --git a/modules/sanity/sanity.c b/modules/sanity/sanity.c
index e60a28c..fe6585a 100644
--- a/modules/sanity/sanity.c
+++ b/modules/sanity/sanity.c
@@ -756,7 +756,7 @@ int check_parse_uris(struct sip_msg* _msg, int checks) {
LOG(L_WARN, "sanity_check(): check_parse_uris():"
" failed to parse From header [%.*s]\n",
_msg->from->body.len, _msg->from->body.s);
- pkg_free(ft_body);
+ free_to(ft_body);
if (_msg->REQ_METHOD != METHOD_ACK) {
if (slb.zreply(_msg, 400, "Bad From header") < 0) {
LOG(L_WARN, "sanity_check(): check_parse_uris():"
diff --git a/modules_k/seas/encode_header.c b/modules_k/seas/encode_header.c
index 0f7e532..549558c 100644
--- a/modules_k/seas/encode_header.c
+++ b/modules_k/seas/encode_header.c
@@ -139,7 +139,7 @@ int encode_header(struct sip_msg *sipmsg,struct hdr_field
*hdr,unsigned char *pa
parse_to(hdr->body.s,hdr->body.s+hdr->body.len+1,tobody);
if (tobody->error == PARSE_ERROR) {
myerror="bad (REFER,TO,FROM,RPID) header\n";
- pkg_free(tobody);
+ free_to(tobody);
return 5;
goto error;
}
diff --git a/parser/msg_parser.c b/parser/msg_parser.c
index 705c5fb..73a86cf 100644
--- a/parser/msg_parser.c
+++ b/parser/msg_parser.c
@@ -156,7 +156,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
tmp=parse_cseq(tmp, end, cseq_b);
if (cseq_b->error==PARSE_ERROR){
LOG(L_ERR, "ERROR: get_hdr_field: bad cseq\n");
- pkg_free(cseq_b);
+ free_cseq(cseq_b);
goto error;
}
hdr->parsed=cseq_b;
@@ -177,7 +177,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
tmp=parse_to(tmp, end,to_b);
if (to_b->error==PARSE_ERROR){
LOG(L_ERR, "ERROR: get_hdr_field: bad to header\n");
- pkg_free(to_b);
+ free_to(to_b);
goto error;
}
hdr->parsed=to_b;
diff --git a/parser/parse_diversion.c b/parser/parse_diversion.c
index e34d9bc..8f07f53 100644
--- a/parser/parse_diversion.c
+++ b/parser/parse_diversion.c
@@ -69,7 +69,7 @@ int parse_diversion_header(struct sip_msg *msg)
parse_to(msg->diversion->body.s, msg->diversion->body.s +
msg->diversion->body.len + 1, diversion_b);
if (diversion_b->error == PARSE_ERROR) {
LOG(L_ERR, "ERROR:parse_diversion_header: bad diversion header\n");
- pkg_free(diversion_b);
+ free_to(diversion_b);
goto error;
}
msg->diversion->parsed = diversion_b;
diff --git a/parser/parse_from.c b/parser/parse_from.c
index c33f391..79c831f 100644
--- a/parser/parse_from.c
+++ b/parser/parse_from.c
@@ -77,7 +77,7 @@ int parse_from_header( struct sip_msg *msg)
parse_to(msg->from->body.s,msg->from->body.s+msg->from->body.len+1,from_b);
if (from_b->error == PARSE_ERROR) {
LOG(L_ERR, "ERROR:parse_from_header: bad from header\n");
- pkg_free(from_b);
+ free_to(from_b);
goto error;
}
msg->from->parsed = from_b;
diff --git a/parser/parse_refer_to.c b/parser/parse_refer_to.c
index 3ccb4a7..dc5bd29 100644
--- a/parser/parse_refer_to.c
+++ b/parser/parse_refer_to.c
@@ -69,7 +69,7 @@ int parse_refer_to_header( struct sip_msg *msg )
refer_to_b);
if (refer_to_b->error == PARSE_ERROR) {
LOG(L_ERR, "ERROR:parse_refer_to_header: bad Refer-To header\n");
- pkg_free(refer_to_b);
+ free_to(refer_to_b);
goto error;
}
msg->refer_to->parsed = refer_to_b;
diff --git a/parser/parse_rpid.c b/parser/parse_rpid.c
index d947932..618bdd1 100644
--- a/parser/parse_rpid.c
+++ b/parser/parse_rpid.c
@@ -66,7 +66,7 @@ int parse_rpid_header( struct sip_msg *msg )
parse_to(msg->rpid->body.s,msg->rpid->body.s+msg->rpid->body.len+1,rpid_b);
if (rpid_b->error == PARSE_ERROR) {
LOG(L_ERR, "ERROR:parse_rpid_header: bad rpid header\n");
- pkg_free(rpid_b);
+ free_to(rpid_b);
goto error;
}
msg->rpid->parsed = rpid_b;