diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c
index a58bcbb9165e4dc9643f87df5fda2f99d11e1d16..856d84a7ad9d165368e82eedd59b0e931778d7a0 100644
--- a/res/res_pjsip_outbound_publish.c
+++ b/res/res_pjsip_outbound_publish.c
@@ -893,7 +893,7 @@ static void sip_outbound_publish_callback(struct pjsip_publishc_cbparam *param)
 		pjsip_publishc_destroy(client->client);
 		client->client = NULL;
 
-		if (sip_outbound_publish_client_alloc(publish)) {
+		if (sip_outbound_publish_client_alloc(client)) {
 			ast_log(LOG_ERROR, "Failed to create a new outbound publish client for '%s' on 412 response\n",
 				ast_sorcery_object_get_id(publish));
 			goto end;