diff mbox series

[1/3] ext2fs: initialize handle to NULL in ext2fs_count_blks

Message ID 20210204233601.2369470-1-harshads@google.com
State Accepted
Headers show
Series [1/3] ext2fs: initialize handle to NULL in ext2fs_count_blks | expand

Commit Message

harshad shirwadkar Feb. 4, 2021, 11:35 p.m. UTC
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

Initialize the handle to NULL to ensure that in error cases,
ext2fs_free_mem can be called on it.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
 lib/ext2fs/extent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Theodore Ts'o Feb. 9, 2021, 4:47 a.m. UTC | #1
On Thu, Feb 04, 2021 at 03:35:59PM -0800, Harshad Shirwadkar wrote:
> From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
> 
> Initialize the handle to NULL to ensure that in error cases,
> ext2fs_free_mem can be called on it.
> 
> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

Thanks, applied.

					- Ted
diff mbox series

Patch

diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index bde6b0f3..1a87e68b 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -1809,7 +1809,7 @@  errcode_t ext2fs_decode_extent(struct ext2fs_extent *to, void *addr, int len)
 errcode_t ext2fs_count_blocks(ext2_filsys fs, ext2_ino_t ino,
 			      struct ext2_inode *inode, blk64_t *ret_count)
 {
-	ext2_extent_handle_t	handle;
+	ext2_extent_handle_t	handle = NULL;
 	struct ext2fs_extent	extent;
 	errcode_t		errcode;
 	int			i;