diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 08352a6e57a7ac16008e481583ab8beea67b215c..e9e2e7465737817f575b19e616af348e9e296103 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -9549,7 +9549,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
 
 	if (!ast_strlen_zero(peer->mailbox)) {
 		char *mailbox, *context;
-		mailbox = ast_strdupa(peer->mailbox);
+		context = mailbox = ast_strdupa(peer->mailbox);
 		strsep(&context, "@");
 		if (ast_strlen_zero(context))
 			context = "default";