fix a potential memory leak in event_once from Scott Lamb

svn:r244
This commit is contained in:
Niels Provos 2006-10-28 03:20:22 +00:00
parent 3eec7f7c64
commit d698965928

View File

@ -459,6 +459,7 @@ event_once(int fd, short events,
{
struct event_once *eonce;
struct timeval etv;
int res;
/* We cannot support signals that just fire once */
if (events & EV_SIGNAL)
@ -487,7 +488,11 @@ event_once(int fd, short events,
return (-1);
}
event_add(&eonce->ev, tv);
res = event_add(&eonce->ev, tv);
if (res != 0) {
free(eonce);
return (res);
}
return (0);
}