Module: sip-router Branch: master Commit: 471589c5c0ae27e9d3937e3b9318982a8ec96fc7 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=471589c5...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Mon Jul 6 22:54:52 2009 +0200
core: error handling for non-sip hooks
receive_msg will exit with error if a non-sip msg hook returns NONSIP_MSG_ERROR.
---
receive.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/receive.c b/receive.c index ac92867..d5215bf 100644 --- a/receive.c +++ b/receive.c @@ -125,8 +125,11 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
if (msg->first_line.type==SIP_REQUEST){ if (!IS_SIP(msg)){ - if (nonsip_msg_run_hooks(msg)!=NONSIP_MSG_ACCEPT) + if ((ret=nonsip_msg_run_hooks(msg))!=NONSIP_MSG_ACCEPT){ + if (unlikely(ret==NONSIP_MSG_ERROR)) + goto error03; goto end; /* drop the message */ + } } /* sanity checks */ if ((msg->via1==0) || (msg->via1->error!=PARSE_OK)){ @@ -257,6 +260,7 @@ error_req: DBG("receive_msg: error:...\n"); /* execute post request-script callbacks */ exec_post_script_cb(msg, REQUEST_CB_TYPE); +error03: /* free possible loaded avps -bogdan */ reset_avps(); error02: