+2020-02-26 Alan Modra <amodra@gmail.com>
+
+ * vms-lib.c (vms_lib_read_index): Release correct buffer.
+
2020-02-26 Alan Modra <amodra@gmail.com>
* elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
unsigned int vbn;
ufile_ptr filesize;
size_t amt;
+ struct carsym *csbuf;
struct carsym_mem csm;
/* Read index desription. */
csm.max = csm.limit;
if (_bfd_mul_overflow (csm.max, sizeof (struct carsym), &amt))
return NULL;
- csm.idx = bfd_alloc (abfd, amt);
+ csm.idx = csbuf = bfd_alloc (abfd, amt);
if (csm.idx == NULL)
return NULL;
vbn = bfd_getl32 (idd.vbn);
if (vbn != 0 && !vms_traverse_index (abfd, vbn, &csm))
{
- if (csm.realloced && csm.idx != NULL)
+ if (csm.realloced)
free (csm.idx);
/* Note: in case of error, we can free what was allocated on the
BFD's objalloc. */
- bfd_release (abfd, csm.idx);
+ bfd_release (abfd, csbuf);
return NULL;
}
{
/* There are more entries than the first estimate. Allocate on
the BFD's objalloc. */
- struct carsym *csbuf;
csbuf = bfd_alloc (abfd, csm.nbr * sizeof (struct carsym));
if (csbuf == NULL)
return NULL;