tlib9: fix memory leak in dial of regular file (#284) - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d96e9e5dc39a356febed132703e46bf73bac6850
(DIR) parent fa7fecff33769e27653a51d1d15909d2b538194b
(HTM) Author: jvd23 <46013531+jvd23@users.noreply.github.com>
Date: Mon, 13 Jan 2020 11:37:48 -0500
lib9: fix memory leak in dial of regular file (#284)
Diffstat:
M src/lib9/dial.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/src/lib9/dial.c b/src/lib9/dial.c
t@@ -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");