diff options
author | Linus Nordberg <linus@nordu.net> | 2011-03-14 00:45:18 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-03-14 00:45:18 +0100 |
commit | 2e315fe5273c899bad4de5f82af9e704edb0bda5 (patch) | |
tree | f3de9ff0cd3c8c73d1d45e1983d25f735538b908 /lib/udp.c | |
parent | c739469b9208ff8eb8bf9833ba4f0440cd7fcc16 (diff) |
Avoid potential double free.
(udp_init): Set conn.rev = NULL in fault case.
Diffstat (limited to 'lib/udp.c')
-rw-r--r-- | lib/udp.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -155,7 +155,10 @@ udp_init (struct rs_connection *conn, struct rs_packet *pkt) if (!conn->rev || !conn->wev) { if (conn->rev) - event_free (conn->rev); + { + event_free (conn->rev); + conn->rev = NULL; + } /* ENOMEM _or_ EINVAL but EINVAL only if we use EV_SIGNAL, at least for now (libevent-2.0.5). */ return rs_err_conn_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL); |