projects
/
paraslash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e16a8a9
)
btr_add_output(): Fix memory leak in case node has no children.
author
Andre Noll
<maan@systemlinux.org>
Sun, 3 Jan 2010 21:45:20 +0000
(22:45 +0100)
committer
Andre Noll
<maan@systemlinux.org>
Sun, 3 Jan 2010 21:45:20 +0000
(22:45 +0100)
buffer_tree.c
patch
|
blob
|
history
diff --git
a/buffer_tree.c
b/buffer_tree.c
index 1a6b6e60d3f977d2d99f600d7a872a1b95250312..c826e8fa26a97c9036595ddf188bb984a7b4ec4e 100644
(file)
--- a/
buffer_tree.c
+++ b/
buffer_tree.c
@@
-119,6
+119,11
@@
void btr_add_output(char *buf, size_t size, struct btr_node *btrn)
{
struct btr_buffer *btrb;
+ assert(size != 0);
+ if (list_empty(&btrn->children)) {
+ free(buf);
+ return;
+ }
btrb = new_btrb(buf, size);
add_btrb_to_children(btrb, btrn, 0);
}