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.1.0.alpha2~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8873e65ea94795876a05e51d42792493d9d94f8e;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 2d5bfea28..e4b32a124 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -1587,7 +1587,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));