Module: sems Branch: master Commit: 94471d111d4f3918b6730f34319ce71a126e065f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=94471d111d4f3918b6730f34319ce71a126e065f
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Tue Feb 25 13:19:05 2014 +0100 b/f: initialize msg_type, be more careful when releasing memory --- core/sip/sip_parser.cpp | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/sip/sip_parser.cpp b/core/sip/sip_parser.cpp index e2822bb..7ec5ca7 100644 --- a/core/sip/sip_parser.cpp +++ b/core/sip/sip_parser.cpp @@ -58,7 +58,8 @@ sip_msg::sip_msg(const char* msg_buf, int msg_len) content_type(NULL), content_length(NULL), body(), - local_socket(NULL) + local_socket(NULL), + type(SIP_UNKNOWN) { u.request = 0; u.reply = 0; @@ -84,7 +85,8 @@ sip_msg::sip_msg() content_type(NULL), content_length(NULL), body(), - local_socket(NULL) + local_socket(NULL), + type(SIP_UNKNOWN) { u.request = 0; u.reply = 0; @@ -106,10 +108,10 @@ sip_msg::~sip_msg() } if(u.request){ - if(type == SIP_REQUEST){ + if(type == SIP_REQUEST && u.request){ delete u.request; } - else { + else if(type == SIP_REPLY && u.reply) { delete u.reply; } } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
