Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 401703) +++ channels/chan_dahdi.c (working copy) @@ -11949,6 +11949,11 @@ return NULL; } +static void monitor_pfds_clean(void *arg) { + struct pollfd **pfds = arg; + ast_free(*pfds); +} + static void *do_monitor(void *data) { int count, res, res2, spoint, pollres=0; @@ -11972,6 +11977,7 @@ #endif pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + pthread_cleanup_push(monitor_pfds_clean, &pfds); for (;;) { /* Lock the interface list */ ast_mutex_lock(&iflock); @@ -12230,6 +12236,7 @@ } ast_mutex_unlock(&iflock); } + pthread_cleanup_pop(1); /* Never reached */ return NULL;