mirror of
https://github.com/zsh-users/zsh
synced 2024-11-02 09:47:59 +00: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>
|
||||
|
||||
* 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);
|
||||
if (!zthost || errflag) {
|
||||
zwarnnam(nam, "host resolution failure: %s", desthost);
|
||||
zsfree(desthost);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -630,6 +631,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
|
|||
|
||||
if (!sess) {
|
||||
zwarnnam(nam, "unable to allocate a TCP session slot");
|
||||
zsfree(desthost);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -665,6 +667,8 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
|
|||
sess->fd = redup(sess->fd, targetfd);
|
||||
if (sess->fd < 0) {
|
||||
zerrnam(nam, "could not duplicate socket fd to %d: %e", targetfd, errno);
|
||||
zsfree(desthost);
|
||||
tcp_close(sess);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue