summaryrefslogtreecommitdiff
path: root/res/res_pjsip_messaging.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip_messaging.c')
-rw-r--r--res/res_pjsip_messaging.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index f7d2e0a67..596223293 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -530,6 +530,10 @@ static struct msg_data* msg_data_create(const struct ast_msg *msg, const char *t
/* Make sure we start with sip: */
mdata->to = ast_begins_with(to, "sip:") ? ast_strdup(++to) : ast_strdup(to - 3);
mdata->from = ast_strdup(from);
+ if (!mdata->to || !mdata->from) {
+ ao2_ref(mdata, -1);
+ return NULL;
+ }
/* sometimes from can still contain the tag at this point, so remove it */
if ((tag = strchr(mdata->from, ';'))) {