]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
tar: omit unnecessary freeing
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Jun 2023 18:33:01 +0000 (11:33 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Jun 2023 21:28:36 +0000 (14:28 -0700)
* src/tar.c (main): Omit unnecessary freeing.

src/tar.c

index d65fc80667f35572f954dbdf8b54dc4789f6afa7..8dbd737bdf22d278c2fb595f8a216a38341a220e 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -2852,11 +2852,14 @@ main (int argc, char **argv)
   if (volno_file_option)
     closeout_volume_number ();
 
-  /* Dispose of allocated memory, and return.  */
-
-  free (archive_name_array);
-  xattrs_clear_setup ();
-  name_term ();
+  /* There is little point to freeing, as we are about to exit,
+     and freeing is more likely to cause than cure trouble.  */
+  if (false)
+    {
+      free (archive_name_array);
+      xattrs_clear_setup ();
+      name_term ();
+    }
 
   if (exit_status == TAREXIT_FAILURE)
     error (0, 0, _("Exiting with failure status due to previous errors"));