public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Harmstone <mark@harmstone.com>
To: Nick Clifton <nickc@redhat.com>, binutils@sourceware.org
Subject: Re: [PATCH] ld: Add module information substream to PDB files
Date: Thu, 3 Nov 2022 02:45:05 +0000	[thread overview]
Message-ID: <a93e5118-123b-43ca-8ee7-0dbd46355da2@harmstone.com> (raw)
In-Reply-To: <d33ba65b-a1ce-1854-ecb8-0fa6f3743bb4@redhat.com>

On 2/11/22 14:12, Nick Clifton wrote:
> 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
>
Thanks Nick, you're right. I couldn't get the warning to trigger with GCC 12.2.1 though, I'm not sure why...

Mark


      reply	other threads:[~2022-11-03  2:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  2:07 Mark Harmstone
2022-11-02 14:12 ` Nick Clifton
2022-11-03  2:45   ` Mark Harmstone [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a93e5118-123b-43ca-8ee7-0dbd46355da2@harmstone.com \
    --to=mark@harmstone.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).