[lxc-devel] [PATCH 2/2] coverity: malloc the right size for btrs_node tree

Stéphane Graber stgraber at ubuntu.com
Sat Aug 16 01:00:45 UTC 2014


On Mon, Aug 11, 2014 at 02:10:59PM +0000, Serge Hallyn wrote:
> We were allocating sizeof(tree) instead of sizeof(*tree).
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/bdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index 2d5bfea..e4b32a1 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));
> -- 
> 2.1.0.rc1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140815/14f22942/attachment.sig>


More information about the lxc-devel mailing list