Module: kamailio Branch: master Commit: dc84c0aaa66573d86633dd12bc42c55961831a76 URL: https://github.com/kamailio/kamailio/commit/dc84c0aaa66573d86633dd12bc42c559...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-11-05T13:33:36+01:00
dmq_usrloc: init vars earlier to avoid invalid value cleanup on error handling
---
Modified: modules/dmq_usrloc/usrloc_sync.c
---
Diff: https://github.com/kamailio/kamailio/commit/dc84c0aaa66573d86633dd12bc42c559... Patch: https://github.com/kamailio/kamailio/commit/dc84c0aaa66573d86633dd12bc42c559...
---
diff --git a/modules/dmq_usrloc/usrloc_sync.c b/modules/dmq_usrloc/usrloc_sync.c index f7fac21..31526d2 100644 --- a/modules/dmq_usrloc/usrloc_sync.c +++ b/modules/dmq_usrloc/usrloc_sync.c @@ -321,16 +321,25 @@ int usrloc_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t*
unsigned int action, expires, cseq, flags, cflags, q, last_modified, methods, reg_id; - str aor, ruid, c, received, path, callid, user_agent, instance; + str aor=STR_NULL, ruid=STR_NULL, c=STR_NULL, received=STR_NULL, + path=STR_NULL, callid=STR_NULL, user_agent=STR_NULL, instance=STR_NULL;
action = expires = cseq = flags = cflags = q = last_modified = methods = reg_id = 0;
- parse_from_header(msg); + srjson_InitDoc(&jdoc, NULL); + if(parse_from_header(msg)<0) { + LM_ERR("failed to parse from header\n"); + goto invalid; + } body = ((struct to_body*)msg->from->parsed)->uri;
LM_DBG("dmq message received from %.*s\n", body.len, body.s);
+ if(parse_headers(msg, HDR_EOH_F, 0)<0) { + LM_ERR("failed to parse the headers\n"); + goto invalid; + } if(!msg->content_length) { LM_ERR("no content length header found\n"); goto invalid; @@ -349,7 +358,6 @@ int usrloc_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* goto error; }
- srjson_InitDoc(&jdoc, NULL); jdoc.buf = body; if(jdoc.root == NULL) { jdoc.root = srjson_Parse(&jdoc, jdoc.buf.s);