Whamcloud - gitweb
ext2fs: initialize handle to NULL in ext2fs_count_blks
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>
Thu, 4 Feb 2021 23:35:59 +0000 (15:35 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 9 Feb 2021 04:36:21 +0000 (23:36 -0500)
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/extent.c

index bde6b0f..1a87e68 100644 (file)
@@ -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;