summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-04-30 22:14:54 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-04-30 22:14:54 -0700
commit46f18acf8e732cffecf71bf2f0d2d03c8236b3fa (patch)
treecb34c92dec351d20f5c2d9589c92066f82eea093
parent4a047c9d70367e00925bbaf1c5991d26ff96d06f (diff)
downloadtxr-46f18acf8e732cffecf71bf2f0d2d03c8236b3fa.tar.gz
txr-46f18acf8e732cffecf71bf2f0d2d03c8236b3fa.tar.bz2
txr-46f18acf8e732cffecf71bf2f0d2d03c8236b3fa.zip
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.
-rw-r--r--buf.c2
1 files changed, 1 insertions, 1 deletions
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;
}