If event_del is called with the event struct (still) zeroed out, a
segmentation fault may occur. event_initialized checks whether the
event struct is nonzero.
Closes #6876
static void remsock(SockInfo *f)
{
if(f) {
- event_del(&f->ev);
+ if(event_initialized(&f->ev)) {
+ event_del(&f->ev);
+ }
free(f);
}
}
f->sockfd = s;
f->action = act;
f->easy = e;
- event_del(&f->ev);
+ if(event_initialized(&f->ev)) {
+ event_del(&f->ev);
+ }
event_assign(&f->ev, g->evbase, f->sockfd, kind, event_cb, g);
event_add(&f->ev, NULL);
}