diff --git a/res/res_fax.c b/res/res_fax.c index 900f21f668d42aa7c65ba489d69d1db27d1b89aa..6141dd7a872cec66d6e16d1754e47a01107de2f7 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -2574,7 +2574,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;