]> 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:43:17 +0000 (21:43 -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 5e45fa9a97f01a7d234c3903e0982f02086ec094..15c89cc45f73cf5d5a18aa26774b142f75bfec57 100644 (file)
@@ -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));