From 95185673f53b84b91ca1473e7434dd6fe453f13b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 30 Dec 2011 10:21:03 +0100 Subject: [PATCH] Fix message leak in the port event handler. Signed-off-by: Richard Cochran --- port.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/port.c b/port.c index cd17cec..7eb096f 100644 --- a/port.c +++ b/port.c @@ -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; }