summaryrefslogtreecommitdiffstats
path: root/buf.c
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
commit6285d863a17dbf5afac81c9b5c8df0947210782a (patch)
treecb34c92dec351d20f5c2d9589c92066f82eea093 /buf.c
parent899a209f71111857b39a2eacb46bcb2484130133 (diff)
downloadtxr-6285d863a17dbf5afac81c9b5c8df0947210782a.tar.gz
txr-6285d863a17dbf5afac81c9b5c8df0947210782a.tar.bz2
txr-6285d863a17dbf5afac81c9b5c8df0947210782a.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.
Diffstat (limited to 'buf.c')
-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;
}