summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCarlin Bingham <cb@viennan.net>2019-03-14 01:07:32 +1300
committerOri Bernstein <ori@eigenstate.org>2019-03-13 23:44:43 -0700
commit1c20d382566fcdfdf5585b1bd8f1f27d7dbd6425 (patch)
tree307d3df2aaf552ee679dcb732d7ce54c0aaea72d /lib
parentadff1dabd7ab37d768b7207b57f572e5d27be01a (diff)
downloadmc-1c20d382566fcdfdf5585b1bd8f1f27d7dbd6425.tar.gz
readdelim: don't leak memory if there's an error
Diffstat (limited to 'lib')
-rw-r--r--lib/bio/bio.myr6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bio/bio.myr b/lib/bio/bio.myr
index 18982f3..2b4d5b1 100644
--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -395,10 +395,8 @@ const unwrapc = {cc, v
const readdelim = {f, delim, mode
var ret, i, j
- var pr
ret = [][:]
- pr = false
if delim.len == 0
-> `std.Ok ret
;;
@@ -421,7 +419,9 @@ const readdelim = {f, delim, mode
| 0: -> `std.Err `Eof
| _: -> `std.Ok ret
;;
- | `std.Err e: -> `std.Err e
+ | `std.Err e:
+ std.slfree(ret)
+ -> `std.Err e
| `std.Ok _: /* nothing: scan the buffer */
;;
for i = f.rstart; i <= f.rend - delim.len; i++