{
struct rs_packet *pkt = (struct rs_packet *) user_data;
assert (pkt);
+ assert (pkt->conn);
if (!pkt->conn->is_connected)
event_on_connect (pkt->conn, pkt);
assert (!conn->bev);
conn->rev = event_new (conn->evb, conn->fd, EV_READ|EV_PERSIST, _evcb, NULL);
- conn->wev = event_new (conn->evb, conn->fd, EV_WRITE, _evcb, pkt);
+ conn->wev = event_new (conn->evb, conn->fd, EV_WRITE, _evcb, NULL);
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);