_evsig_restore_handler(base, i);
}
- EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
- base->sig.ev_signal_pair[0] = -1;
- EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
- base->sig.ev_signal_pair[1] = -1;
+ if (base->sig.ev_signal_pair[0] != -1) {
+ EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
+ base->sig.ev_signal_pair[0] = -1;
+ }
+ if (base->sig.ev_signal_pair[1] != -1) {
+ EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
+ base->sig.ev_signal_pair[1] = -1;
+ }
base->sig.sh_old_max = 0;
/* per index frees are handled in evsig_del() */
- if (base->sig.sh_old)
+ if (base->sig.sh_old) {
mm_free(base->sig.sh_old);
+ base->sig.sh_old = NULL;
+ }
}