]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: malloc the right size for btrs_node tree
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 11 Aug 2014 14:10:59 +0000 (14:10 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 16 Aug 2014 01:03:14 +0000 (21:03 -0400)
We were allocating sizeof(tree) instead of sizeof(*tree).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/bdev.c

index 2d5bfea28eb012e9ca2765fcad91eff56b635ff6..e4b32a124d79dbd8d397da4c4e8fadd92151a8fd 100644 (file)
@@ -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));