Fix message leak in the port event handler.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2011-12-30 10:21:03 +01:00
parent 50b82c200d
commit 95185673f5
1 changed files with 4 additions and 1 deletions

5
port.c
View File

@ -872,11 +872,14 @@ enum fsm_event port_event(struct port *p, int fd_index)
msg->hwts.type = p->timestamping;
cnt = p->transport->recv(fd, msg, sizeof(*msg), &msg->hwts);
if (cnt <= 0)
if (cnt <= 0) {
msg_put(msg);
return EV_FAULT_DETECTED;
}
if (msg_post_recv(msg, cnt)) {
pr_err("port %hu: bad message", portnum(p));
msg_put(msg);
return EV_NONE;
}