aboutsummaryrefslogtreecommitdiff
path: root/imsg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-04-07 18:09:39 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-04-07 18:09:39 +0000
commita2c86dcbf6464634ebbc63ef1cd2966b8ef132f9 (patch)
tree1e80d73ceb1a54956be5edc14220ba5a62c965e8 /imsg.c
parentac9daf92d72210570dc9cb63fd0058e4ff50b7a5 (diff)
downloadrtmux-a2c86dcbf6464634ebbc63ef1cd2966b8ef132f9.tar.gz
rtmux-a2c86dcbf6464634ebbc63ef1cd2966b8ef132f9.tar.bz2
rtmux-a2c86dcbf6464634ebbc63ef1cd2966b8ef132f9.zip
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 'imsg.c')
-rw-r--r--imsg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/imsg.c b/imsg.c
index 263c7c8c..1be7f5ae 100644
--- a/imsg.c
+++ b/imsg.c
@@ -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;