xfs
[Top] [All Lists]

Re: [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Mon, 14 Apr 2014 09:54:24 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <534BF4CD.1080702@xxxxxxxxxxx>
References: <534BF472.8030908@xxxxxxxxxxx> <534BF4CD.1080702@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
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@xxxxxxxxxx>
---

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@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>