mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-16 14:41:02 +02:00
33785: Fix leaks of desthost in ztcp
Found by coverity.
This commit is contained in:
parent
2b615bedaf
commit
e2fe81ae9a
2 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2014-11-24 Mikael Magnusson <mikachu@gmail.com>
|
||||||
|
|
||||||
|
* 33785: Src/Modules/tcp.c: Fix leaks of desthost in ztcp.
|
||||||
|
|
||||||
2014-11-23 Barton E. Schaefer <schaefer@zsh.org>
|
2014-11-23 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* 33775: Src/exec.c: error opening file in $(<...) is not fatal
|
* 33775: Src/exec.c: error opening file in $(<...) is not fatal
|
||||||
|
|
|
@ -623,6 +623,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
|
||||||
zthost = zsh_getipnodebyname(desthost, AF_INET, 0, &herrno);
|
zthost = zsh_getipnodebyname(desthost, AF_INET, 0, &herrno);
|
||||||
if (!zthost || errflag) {
|
if (!zthost || errflag) {
|
||||||
zwarnnam(nam, "host resolution failure: %s", desthost);
|
zwarnnam(nam, "host resolution failure: %s", desthost);
|
||||||
|
zsfree(desthost);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,6 +631,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
|
||||||
|
|
||||||
if (!sess) {
|
if (!sess) {
|
||||||
zwarnnam(nam, "unable to allocate a TCP session slot");
|
zwarnnam(nam, "unable to allocate a TCP session slot");
|
||||||
|
zsfree(desthost);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,6 +667,8 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
|
||||||
sess->fd = redup(sess->fd, targetfd);
|
sess->fd = redup(sess->fd, targetfd);
|
||||||
if (sess->fd < 0) {
|
if (sess->fd < 0) {
|
||||||
zerrnam(nam, "could not duplicate socket fd to %d: %e", targetfd, errno);
|
zerrnam(nam, "could not duplicate socket fd to %d: %e", targetfd, errno);
|
||||||
|
zsfree(desthost);
|
||||||
|
tcp_close(sess);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue