diff options
author | Szabolcs Nagy <nsz@port70.net> | 2015-12-05 21:04:18 +0100 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-12-08 18:52:38 -0500 |
commit | bc9744763afe72d626e7b9f461001d425582fe9c (patch) | |
tree | cdb68eaf09ef84a13873ff2131a399d0a43ac4ef | |
parent | e4f9d811684011d8a67e363827de39d5f2d3ae5a (diff) | |
download | musl-bc9744763afe72d626e7b9f461001d425582fe9c.tar.gz musl-bc9744763afe72d626e7b9f461001d425582fe9c.tar.xz musl-bc9744763afe72d626e7b9f461001d425582fe9c.zip |
fix tsearch to avoid crash on oom
malloc failure was not properly propagated in the insertion method which led to null pointer dereference.
-rw-r--r-- | src/search/tsearch_avl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/search/tsearch_avl.c b/src/search/tsearch_avl.c index 08644607..8c2f3470 100644 --- a/src/search/tsearch_avl.c +++ b/src/search/tsearch_avl.c @@ -89,8 +89,8 @@ static struct node *insert(struct node **n, const void *k, r->key = k; r->left = r->right = 0; r->height = 1; + *new = 1; } - *new = 1; return r; } c = cmp(k, r->key); |