summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-04-07 18:09:40 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-04-07 18:09:40 +0000
commit5670bacc392644691373d19999fd2db942d2653c (patch)
treeece9fa3fda23de597c0c124cc6db8816dea7e132 /usr.bin
parent1193b810e8339e64b525abb97aeb0c8cbd30cd10 (diff)
Remove XXX comment and just close received fd if calloc() fails.
If this happens the imsg may no longer be usable as there may be queued messages, but this is a) already the case with the code now, and b) would be the case if recvmsg() fails anyway, so we can document that -1 from imsg_read() invalidates the struct imsgbuf. discussed with and ok eric
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/imsg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/imsg.c b/usr.bin/tmux/imsg.c
index 4ba37f42d01..1a229281a72 100644
--- a/usr.bin/tmux/imsg.c
+++ b/usr.bin/tmux/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.1 2009/08/11 17:18:35 nicm Exp $ */
+/* $OpenBSD: imsg.c,v 1.2 2010/04/07 18:09:39 nicm Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -79,7 +79,7 @@ imsg_read(struct imsgbuf *ibuf)
cmsg->cmsg_type == SCM_RIGHTS) {
fd = (*(int *)CMSG_DATA(cmsg));
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) {
- /* XXX: this return can leak */
+ close(fd);
return (-1);
}
ifd->fd = fd;