[PATCH] ld: Add module information substream to PDB files

Nick Clifton nickc@redhat.com
Wed Nov 2 14:12:28 GMT 2022


Hi Mark,

> +  *data = xmalloc (*size);
> +
> +  ptr = *data;
> +
> +  for (bfd *in = coff_data (abfd)->link_info->input_bfds; in;
> +       in = in->link.next)
> +    {
> +      struct module_info *mod = (struct module_info *) ptr;
> +      uint16_t stream_num;
> +      bfd *stream;
> +      uint32_t sym_byte_size;
> +      uint8_t *start = ptr;
> +
> +      stream = add_stream (pdb, NULL, &stream_num);
> +
> +      if (!stream)
> +	{
> +	  free (data);
> +	  return false;
> +	}

This fails to compile with:

    inlined from 'create_pdb_file' at /work/sources/binutils/upstream/current/ld/pdb.c:1097:8:
/work/sources/binutils/upstream/current/ld/pdb.c:481:11: error: 'free' called on unallocated object 'mod_info' [-Werror=free-nonheap-object]
   481 |           free (data);
       |           ^~~~~~~~~~~
/work/sources/binutils/upstream/current/ld/pdb.c: In function 'create_pdb_file':
/work/sources/binutils/upstream/current/ld/pdb.c:604:9: note: declared here
   604 |   void *mod_info;

Possibly you meant "free (*data)" ?

Cheers
   Nick



More information about the Binutils mailing list