ref: 1c20d382566fcdfdf5585b1bd8f1f27d7dbd6425
parent: adff1dabd7ab37d768b7207b57f572e5d27be01a
author: Carlin Bingham <cb@viennan.net>
date: Wed Mar 13 21:07:32 EDT 2019
readdelim: don't leak memory if there's an error
--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -395,10 +395,8 @@
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 @@
| 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++