mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
PR26069, strip/objcopy memory leaks
PR 26069 * objcopy.c (copy_relocations_in_section): Free relpp on error. Don't accidentally free isection->orelocation.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2020-06-03 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR 26069
|
||||||
|
* objcopy.c (copy_relocations_in_section): Free relpp on error.
|
||||||
|
Don't accidentally free isection->orelocation.
|
||||||
|
|
||||||
2020-06-02 Alan Modra <amodra@gmail.com>
|
2020-06-02 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* testsuite/binutils-all/ar.exp (obj): Set up object file name
|
* testsuite/binutils-all/ar.exp (obj): Set up object file name
|
||||||
|
@ -4294,6 +4294,7 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||||||
status = 1;
|
status = 1;
|
||||||
bfd_nonfatal_message (NULL, ibfd, isection,
|
bfd_nonfatal_message (NULL, ibfd, isection,
|
||||||
_("relocation count is negative"));
|
_("relocation count is negative"));
|
||||||
|
free (relpp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4318,7 +4319,7 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||||||
temp_relpp [temp_relcount++] = relpp [i];
|
temp_relpp [temp_relcount++] = relpp [i];
|
||||||
}
|
}
|
||||||
relcount = temp_relcount;
|
relcount = temp_relcount;
|
||||||
if (isection->orelocation == NULL)
|
if (relpp != isection->orelocation)
|
||||||
free (relpp);
|
free (relpp);
|
||||||
relpp = temp_relpp;
|
relpp = temp_relpp;
|
||||||
}
|
}
|
||||||
@ -4327,6 +4328,7 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||||||
if (relcount == 0)
|
if (relcount == 0)
|
||||||
{
|
{
|
||||||
osection->flags &= ~SEC_RELOC;
|
osection->flags &= ~SEC_RELOC;
|
||||||
|
if (relpp != isection->orelocation)
|
||||||
free (relpp);
|
free (relpp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user