Re: [PATCH 1/5] e2image: fix resource leak when running e2image -n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/2/14, 11:29 PM, Theodore Ts'o wrote:
> Addresses-Coverity-ID: #1147783
> 
> Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx>

Thanks for fixing these - 

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

(Aside:  Seems odd that -n emits "Writing block XXX" when it's
not actually writing anything, but *shrug*)

-Eric

> ---
>  misc/e2image.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/misc/e2image.c b/misc/e2image.c
> index ab6a4fa..253fad1 100644
> --- a/misc/e2image.c
> +++ b/misc/e2image.c
> @@ -174,7 +174,7 @@ static void generic_write(int fd, void *buf, int blocksize, blk64_t block)
>  		printf(_("Writing block %llu\n"), (unsigned long long) block);
>  		if (fd != 1)
>  			seek_relative(fd, blocksize);
> -		return;
> +		goto free_and_return;
>  	}
>  	count = write(fd, buf, blocksize);
>  	if (count != blocksize) {
> @@ -191,6 +191,7 @@ static void generic_write(int fd, void *buf, int blocksize, blk64_t block)
>  
>  		exit(1);
>  	}
> +free_and_return:
>  	if (free_buf)
>  		ext2fs_free_mem(&buf);
>  }
> 

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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux