From 520a93a3e64f3b896cfd20e43f25832edd464211 Mon Sep 17 00:00:00 2001 From: "Bradley C. Kuszmaul" Date: Thu, 6 Mar 2008 22:48:07 +0000 Subject: [PATCH] off-end-of-memory error found by valgrind. Addresses #126 git-svn-id: file:///svn/tokudb@2599 c7de825b-a66e-492c-adef-691d508d4ae1 --- newbrt/brt-serialize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newbrt/brt-serialize.c b/newbrt/brt-serialize.c index 8c3d470f7ed..11baf9be10d 100644 --- a/newbrt/brt-serialize.c +++ b/newbrt/brt-serialize.c @@ -281,8 +281,8 @@ int toku_deserialize_brtnode_from (int fd, DISKOFF off, BRTNODE *brtnode, int fl u_int32_t subtree_fingerprint = rbuf_int(&rc); u_int32_t check_subtree_fingerprint = 0; result->u.n.n_children = rbuf_int(&rc); - MALLOC_N(result->u.n.n_children, result->u.n.childinfos); - MALLOC_N(result->u.n.n_children-1, result->u.n.childkeys); + MALLOC_N(result->u.n.n_children+1, result->u.n.childinfos); + MALLOC_N(result->u.n.n_children, result->u.n.childkeys); //printf("n_children=%d\n", result->n_children); assert(result->u.n.n_children>=0 && result->u.n.n_children<=TREE_FANOUT); for (i=0; iu.n.n_children; i++) {