diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 812232ef1486466b9c81fd618b48daae34c523a6..cc73a15054f5e807543f5bfb2badd96bd8d6c241 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4757,6 +4757,11 @@ static int sip_queryoption(struct ast_channel *chan, int option, void *data, int struct sip_pvt *p = (struct sip_pvt *) ast_channel_tech_pvt(chan); char *cp; + if (!p) { + ast_debug(1, "Attempt to Ref a null pointer. Sip private structure is gone!\n"); + return -1; + } + sip_pvt_lock(p); switch (option) {