diff mbox

[6/6] btrfs-progs: let btrfs_free_path accept NULL

Message ID b0dc8fd2b3473c0daddde7e2bc59cd13e1963907.1419005022.git.dsterba@suse.cz (mailing list archive)
State Accepted
Headers show

Commit Message

David Sterba Dec. 19, 2014, 4:06 p.m. UTC
Same in kernel and matches semantics of free().

Resolves-Coverity-CID: 1054881
Signed-off-by: David Sterba <dsterba@suse.cz>
---
 ctree.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Eric Sandeen Dec. 19, 2014, 4:58 p.m. UTC | #1
On 12/19/14 10:06 AM, David Sterba wrote:
> Same in kernel and matches semantics of free().
> 
> Resolves-Coverity-CID: 1054881
> Signed-off-by: David Sterba <dsterba@suse.cz>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  ctree.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/ctree.c b/ctree.c
> index bd6cb125b2a2..589efa3db17e 100644
> --- a/ctree.c
> +++ b/ctree.c
> @@ -48,6 +48,8 @@ struct btrfs_path *btrfs_alloc_path(void)
>  
>  void btrfs_free_path(struct btrfs_path *p)
>  {
> +	if (!p)
> +		return;
>  	btrfs_release_path(p);
>  	kfree(p);
>  }
> 

--
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/ctree.c b/ctree.c
index bd6cb125b2a2..589efa3db17e 100644
--- a/ctree.c
+++ b/ctree.c
@@ -48,6 +48,8 @@  struct btrfs_path *btrfs_alloc_path(void)
 
 void btrfs_free_path(struct btrfs_path *p)
 {
+	if (!p)
+		return;
 	btrfs_release_path(p);
 	kfree(p);
 }