mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
fix a potential memory leak in event_once from Scott Lamb
svn:r244
This commit is contained in:
parent
3eec7f7c64
commit
d698965928
7
event.c
7
event.c
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user