aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-01-27 10:39:22 +0000
committerNick Clifton <nickc@redhat.com>2021-01-27 10:39:22 +0000
commit67965ba2894566ea707510929d75733a4a254cd4 (patch)
tree1048629fa1f6809c52247aff7403b227877fe575 /binutils
parent2eda57ef61f33ac3da0aabd94364e6c8396020eb (diff)
downloadfsf-binutils-gdb-67965ba2894566ea707510929d75733a4a254cd4.zip
fsf-binutils-gdb-67965ba2894566ea707510929d75733a4a254cd4.tar.gz
fsf-binutils-gdb-67965ba2894566ea707510929d75733a4a254cd4.tar.bz2
Simplify the code at the end of objcopy's main() function.
* objcopy.c (copy_main): Remove conditional control of the calls to free, simplifying the code and making it easier to detect typos.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objcopy.c33
2 files changed, 15 insertions, 24 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index fd9f4bd..712a9eb 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2021-01-27 Nick Clifton <nickc@redhat.com>
+
+ * objcopy.c (copy_main): Remove conditional control of the calls
+ to free, simplifying the code and making it easier to detect
+ typos.
+
2021-01-26 Frederic Cambus <fred@statdns.com>
* objcopy.c (copy_main): Fix a double free happening when both
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index a5cead1..39a1ccb 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2793,8 +2793,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
pe->timestamp = pe_data (ibfd)->coff.timestamp;
}
- if (isympp)
- free (isympp);
+ free (isympp);
if (osympp != isympp)
free (osympp);
@@ -4612,8 +4611,7 @@ mark_symbols_used_in_relocations (bfd *ibfd, sec_ptr isection, void *symbolsarg)
(*relpp[i]->sym_ptr_ptr)->flags |= BSF_KEEP;
}
- if (relpp != NULL)
- free (relpp);
+ free (relpp);
}
/* Write out debugging information. */
@@ -6008,26 +6006,13 @@ copy_main (int argc, char *argv[])
}
}
- if (strip_specific_buffer)
- free (strip_specific_buffer);
-
- if (strip_unneeded_buffer)
- free (strip_unneeded_buffer);
-
- if (keep_specific_buffer)
- free (keep_specific_buffer);
-
- if (localize_specific_buffer)
- free (localize_specific_buffer);
-
- if (globalize_specific_buffer)
- free (globalize_specific_buffer);
-
- if (keepglobal_specific_buffer)
- free (keepglobal_specific_buffer);
-
- if (weaken_specific_buffer)
- free (weaken_specific_buffer);
+ free (strip_specific_buffer);
+ free (strip_unneeded_buffer);
+ free (keep_specific_buffer);
+ free (localize_specific_buffer);
+ free (globalize_specific_buffer);
+ free (keepglobal_specific_buffer);
+ free (weaken_specific_buffer);
return 0;
}