From: Serge Hallyn Date: Mon, 11 Aug 2014 14:10:59 +0000 (+0000) Subject: coverity: malloc the right size for btrs_node tree X-Git-Tag: lxc-1.0.6~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7aa66be8b12876f10b34da185093fb7a4003fbaf;p=thirdparty%2Flxc.git coverity: malloc the right size for btrs_node tree We were allocating sizeof(tree) instead of sizeof(*tree). Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c index 5e45fa9a9..15c89cc45 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -1586,7 +1586,7 @@ static struct my_btrfs_tree *create_my_btrfs_tree(u64 id, const char *path, int { struct my_btrfs_tree *tree; - tree = malloc(sizeof(tree)); + tree = malloc(sizeof(struct my_btrfs_tree)); if (!tree) return NULL; tree->nodes = malloc(sizeof(struct mytree_node));