aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjvd23 <46013531+jvd23@users.noreply.github.com>2020-01-13 11:37:48 -0500
committerRuss Cox <rsc@golang.org>2020-01-13 11:38:17 -0500
commitd96e9e5dc39a356febed132703e46bf73bac6850 (patch)
treefeb6afdeaa759e59d3db11f6d359a9cebaf55709 /src
parentfa7fecff33769e27653a51d1d15909d2b538194b (diff)
downloadplan9port-d96e9e5dc39a356febed132703e46bf73bac6850.tar.gz
plan9port-d96e9e5dc39a356febed132703e46bf73bac6850.tar.bz2
plan9port-d96e9e5dc39a356febed132703e46bf73bac6850.zip
lib9: fix memory leak in dial of regular file (#284)
Diffstat (limited to 'src')
-rw-r--r--src/lib9/dial.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib9/dial.c b/src/lib9/dial.c
index c3dd1762..81e3a830 100644
--- a/src/lib9/dial.c
+++ b/src/lib9/dial.c
@@ -141,8 +141,10 @@ Unix:
return -1;
}
/* Allow regular files in addition to Unix sockets. */
- if((s = open(unix, ORDWR)) >= 0)
+ if((s = open(unix, ORDWR)) >= 0){
+ free(buf);
return s;
+ }
free(buf);
if((s = socket(ss.ss_family, SOCK_STREAM, 0)) < 0){
werrstr("socket: %r");