diff --git a/channels/chan_zap.c b/channels/chan_zap.c index bdc786fa99..556cdc59c6 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -7163,8 +7163,10 @@ static void *do_monitor(void *data) /* Lock the interface list */ ast_mutex_lock(&iflock); if (!pfds || (lastalloc != ifcount)) { - if (pfds) + if (pfds) { ast_free(pfds); + pfds = NULL; + } if (ifcount) { if (!(pfds = ast_calloc(1, ifcount * sizeof(*pfds)))) { ast_mutex_unlock(&iflock);