bug-cpio
[Top][All Lists]
Advanced

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

[Bug-cpio] small leak fix


From: Pavel Raiskup
Subject: [Bug-cpio] small leak fix
Date: Mon, 11 Mar 2013 14:13:59 +0100

Hello, could you please look at following patch?  Fedora users have found
this sanity fix for small memory leak useful.  Relevant Red Hat bug:

  https://bugzilla.redhat.com/show_bug.cgi?id=919454

Pavel

====================================================================

>From 94570903927141bf775c8d95fa385e22c77315af Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <address@hidden>
Date: Mon, 11 Mar 2013 13:57:18 +0100
Subject: [PATCH] sanity: remove small leak in copy-in mode

* src/copyin.c (process_copy_in): Do not leak the last file name pointed to
by 'file_hdr.c_name'.
---
 src/copyin.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/copyin.c b/src/copyin.c
index 3282816..b1450fc 100644
--- a/src/copyin.c
+++ b/src/copyin.c
@@ -1480,7 +1480,7 @@ process_copy_in ()
   apply_delayed_set_stat ();
   
   if (append_flag)
-    return;
+    goto out;
 
   if (archive_format == arf_newascii || archive_format == arf_crcascii)
     {
@@ -1495,5 +1495,8 @@ process_copy_in ()
                         (unsigned long) blocks),
               (unsigned long) blocks);
     }
+
+ out:
+  free (file_hdr.c_name);
 }
 
-- 
1.8.1.4














reply via email to

[Prev in Thread] Current Thread [Next in Thread]