xfs
[Top] [All Lists]

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

To: xfs-oss <xfs@xxxxxxxxxxx>, Mark Tinguely <tinguely@xxxxxxx>
Subject: [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Mon, 14 Apr 2014 09:46:37 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <534BF472.8030908@xxxxxxxxxxx>
References: <534BF472.8030908@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
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) {

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