From 46f18acf8e732cffecf71bf2f0d2d03c8236b3fa Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 30 Apr 2017 22:14:54 -0700 Subject: buf: fix memory leak. * buf.c (make_duplicate_buf): A duplicated buf is dynamic, so the size must not be nil, which indicates a static or borrowed one. Set the size properly, so finalize will free it. --- buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buf.c b/buf.c index 661514be..88f5f166 100644 --- a/buf.c +++ b/buf.c @@ -114,7 +114,7 @@ val make_duplicate_buf(val len, mem_t *data) obj->b.type = BUF; obj->b.data = chk_copy_obj(data, c_num(len)); obj->b.len = len; - obj->b.size = nil; + obj->b.size = len; return obj; } -- cgit v1.2.3