diff mbox series

[11/10] libfrog: fix memory leak in bitmap_free

Message ID 20190423210409.GC178290@magnolia (mailing list archive)
State Accepted, archived
Headers show
Series xfsprogs-5.0: fix various problems | expand

Commit Message

Darrick J. Wong April 23, 2019, 9:04 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Free the bitmap struct before we null out the caller's pointer.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libfrog/bitmap.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Bill O'Donnell April 23, 2019, 9:23 p.m. UTC | #1
On Tue, Apr 23, 2019 at 02:04:09PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Free the bitmap struct before we null out the caller's pointer.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
>  libfrog/bitmap.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libfrog/bitmap.c b/libfrog/bitmap.c
> index aecdba0d..450ebe0a 100644
> --- a/libfrog/bitmap.c
> +++ b/libfrog/bitmap.c
> @@ -104,6 +104,7 @@ bitmap_free(
>  		free(ext);
>  	}
>  	free(bmap->bt_tree);
> +	free(bmap);
>  	*bmapp = NULL;
>  }
>
diff mbox series

Patch

diff --git a/libfrog/bitmap.c b/libfrog/bitmap.c
index aecdba0d..450ebe0a 100644
--- a/libfrog/bitmap.c
+++ b/libfrog/bitmap.c
@@ -104,6 +104,7 @@  bitmap_free(
 		free(ext);
 	}
 	free(bmap->bt_tree);
+	free(bmap);
 	*bmapp = NULL;
 }