mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 17:39:09 +00:00
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
This commit is contained in:
parent
ac9daf92d7
commit
a2c86dcbf6
2
imsg.c
2
imsg.c
@ -79,7 +79,7 @@ imsg_read(struct imsgbuf *ibuf)
|
|||||||
cmsg->cmsg_type == SCM_RIGHTS) {
|
cmsg->cmsg_type == SCM_RIGHTS) {
|
||||||
fd = (*(int *)CMSG_DATA(cmsg));
|
fd = (*(int *)CMSG_DATA(cmsg));
|
||||||
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) {
|
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) {
|
||||||
/* XXX: this return can leak */
|
close(fd);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
ifd->fd = fd;
|
ifd->fd = fd;
|
||||||
|
Loading…
Reference in New Issue
Block a user