diff mbox

Btrfs-progs: add missing path alloc return value check

Message ID 1374216370-18953-1-git-send-email-fdmanana@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Filipe Manana July 19, 2013, 6:46 a.m. UTC
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 extent-tree.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Miao Xie July 19, 2013, 7:58 a.m. UTC | #1
On thu, 18 Jul 2013 23:46:10 -0700, Filipe David Borba Manana wrote:
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
> ---
>  extent-tree.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/extent-tree.c b/extent-tree.c
> index f597e16..8e93bab 100644
> --- a/extent-tree.c
> +++ b/extent-tree.c
> @@ -1577,6 +1577,8 @@ int btrfs_set_block_flags(struct btrfs_trans_handle *trans,
>  				  BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA);
>  
>  	path = btrfs_alloc_path();
> +	if (!path)
> +		return -ENOMEM;
>  	path->reada = 1;
>  
>  	key.objectid = bytenr;
> 

Many functions have the same problem, you can fix them in this patch.

Thanks
Miao
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/extent-tree.c b/extent-tree.c
index f597e16..8e93bab 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -1577,6 +1577,8 @@  int btrfs_set_block_flags(struct btrfs_trans_handle *trans,
 				  BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA);
 
 	path = btrfs_alloc_path();
+	if (!path)
+		return -ENOMEM;
 	path->reada = 1;
 
 	key.objectid = bytenr;