diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 6c09670819..5a107f242d 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -10304,8 +10304,9 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m) static int __unload_module(void) { - int x = 0; + int x; struct zt_pvt *p, *pl; + #ifdef HAVE_PRI int i; for (i = 0; i < NUM_SPANS; i++) { @@ -10354,7 +10355,7 @@ static int __unload_module(void) zt_close(p->subs[SUB_REAL].zfd); pl = p; p = p->next; - x++; + x = pl->channel; /* Free associated memory */ if (pl) destroy_zt_pvt(&pl);