Update code

This commit is contained in:
Nick Peng
2018-11-11 22:39:33 +08:00
parent 6e2c0da46d
commit 08024010fe
3 changed files with 7 additions and 3 deletions

View File

@@ -384,7 +384,7 @@ art_leaf* art_maximum(art_tree *t) {
}
static art_leaf* make_leaf(const unsigned char *key, int key_len, void *value) {
art_leaf *l = (art_leaf*)calloc(1, sizeof(art_leaf)+key_len);
art_leaf *l = (art_leaf*)calloc(1, sizeof(art_leaf)+key_len+1);
l->value = value;
l->key_len = key_len;
memcpy(l->key, key, key_len);