[PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi
Mark Tinguely
tinguely at sgi.com
Mon Apr 14 09:54:24 CDT 2014
On 04/14/14 09:46, Eric Sandeen wrote:
> A recent change to xlog_print_trans_efi() led to a leaked
> "src_f" on this error return.
>
> Signed-off-by: Eric Sandeen<sandeen at redhat.com>
> ---
>
> diff --git a/logprint/log_misc.c b/logprint/log_misc.c
> index 928f60a..d482cf3 100644
> --- a/logprint/log_misc.c
> +++ b/logprint/log_misc.c
> @@ -482,7 +482,7 @@ xlog_print_trans_efi(
> uint src_len,
> int continued)
> {
> - xfs_efi_log_format_t *src_f, *f;
> + xfs_efi_log_format_t *src_f, *f = NULL;
> uint dst_len;
> xfs_extent_t *ex;
> int i;
> @@ -505,7 +505,8 @@ xlog_print_trans_efi(
>
> if (continued&& src_len< core_size) {
> printf(_("EFI: Not enough data to decode further\n"));
> - return 1;
> + error = 1;
> + goto error;
> }
>
> if ((f = (xfs_efi_log_format_t *)malloc(dst_len)) == NULL) {
>
Looks good. Thank-you Eric and Coverity.
Reviewed-by: Mark Tinguely <tinguely at sgi.com>
More information about the xfs
mailing list