diff --git a/res/res_fax.c b/res/res_fax.c index 9cb8292f01..cc3e23fe6a 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -2583,7 +2583,9 @@ static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session } /* release the reference for the reserved session and replace it with * the real session */ - ao2_ref(gateway->s, -1); + if (gateway->s) { + ao2_ref(gateway->s, -1); + } gateway->s = s; gateway->token = NULL;