From: Alan Modra Date: Sat, 18 Jan 2025 00:25:22 +0000 (+1030) Subject: Re: binary outsymbols X-Git-Tag: binutils-2_44~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26dd9cb647140db87a5a530fd9f044d356e081de;p=thirdparty%2Fbinutils-gdb.git Re: binary outsymbols The "of course to free outsymbols" turned out to be wrong. outsymbols belongs to objcopy which frees them, so commit 6ca01b0bdd59 introduced a double free. * srec.c (srec_write_symbols): Don't free outsymbols. * tekhex.c (tekhex_write_object_contents): Likewise. --- diff --git a/bfd/srec.c b/bfd/srec.c index a7ccf232531..1509bebd6c1 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1114,13 +1114,9 @@ srec_write_symbols (bfd *abfd) goto fail; } - free (abfd->outsymbols); - abfd->outsymbols = NULL; return true; fail: - free (abfd->outsymbols); - abfd->outsymbols = NULL; return false; } diff --git a/bfd/tekhex.c b/bfd/tekhex.c index ef2bb25fe46..aab0b2f5592 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -886,13 +886,9 @@ tekhex_write_object_contents (bfd *abfd) /* And the terminator. */ if (bfd_write ("%0781010\n", 9, abfd) != 9) goto fail; - free (abfd->outsymbols); - abfd->outsymbols = NULL; return true; fail: - free (abfd->outsymbols); - abfd->outsymbols = NULL; return false; }