Merge branch 'fix-recv-memleak'
This commit is contained in:
commit
89be6cb509
@ -833,14 +833,16 @@ handler_t handlers[8] = {
|
|||||||
static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
|
static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
|
||||||
uint32_t message_type;
|
uint32_t message_type;
|
||||||
uint32_t message_length;
|
uint32_t message_length;
|
||||||
uint8_t *message;
|
uint8_t *message = NULL;
|
||||||
|
|
||||||
int ret = ipc_recv_message(w->fd, &message_type, &message_length, &message);
|
int ret = ipc_recv_message(w->fd, &message_type, &message_length, &message);
|
||||||
/* EOF or other error */
|
/* EOF or other error */
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* Was this a spurious read? See ev(3) */
|
/* Was this a spurious read? See ev(3) */
|
||||||
if (ret == -1 && errno == EAGAIN)
|
if (ret == -1 && errno == EAGAIN) {
|
||||||
|
FREE(message);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* If not, there was some kind of error. We don’t bother
|
/* If not, there was some kind of error. We don’t bother
|
||||||
* and close the connection */
|
* and close the connection */
|
||||||
@ -863,6 +865,7 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
|
|||||||
|
|
||||||
ev_io_stop(EV_A_ w);
|
ev_io_stop(EV_A_ w);
|
||||||
free(w);
|
free(w);
|
||||||
|
FREE(message);
|
||||||
|
|
||||||
DLOG("IPC: client disconnected\n");
|
DLOG("IPC: client disconnected\n");
|
||||||
return;
|
return;
|
||||||
@ -874,6 +877,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
|
|||||||
handler_t h = handlers[message_type];
|
handler_t h = handlers[message_type];
|
||||||
h(w->fd, message, 0, message_length, message_type);
|
h(w->fd, message, 0, message_length, message_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FREE(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user