Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Orgad Shaneh <orgads@gmail.com>
Cc: gdb-patches@sourceware.org,  Jon Turney <jon.turney@dronecode.org.uk>
Subject: Re: [PATCH] Better handling for realpath() failures in windows_make_so() on Cygwin
Date: Thu, 21 Mar 2024 09:04:09 -0600	[thread overview]
Message-ID: <87sf0jeidy.fsf@tromey.com> (raw)
In-Reply-To: <20240321072349.1160-1-orgads@gmail.com> (Orgad Shaneh's message of "Thu, 21 Mar 2024 09:22:53 +0200")

>>>>> "Orgad" == Orgad Shaneh <orgads@gmail.com> writes:

Orgad> From: Jon Turney <jon.turney@dronecode.org.uk>
Orgad> Fix a memory leak which would occur in the case when the result of realpath() is
Orgad> greater than or equal to SO_NAME_MAX_PATH_SIZE.

Thanks for the patch.

Orgad> +      if (rname)
Orgad> +	free (rname);

No need to check for NULL when calling free -- and gdb uses 'xfree'
anyway.

However, it would be better to change this code to use gdb_realpath,
which returns a unique pointer.  Then the memory leak will be
impossible.  Could you try that instead?

thanks,
Tom

  reply	other threads:[~2024-03-21 15:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21  6:53 Orgad Shaneh
2024-03-21  7:22 ` Orgad Shaneh
2024-03-21 15:04   ` Tom Tromey [this message]
2024-03-21 14:45 ` Jon Turney
2024-03-21 16:13   ` Pedro Alves
2024-03-21 16:31     ` Orgad Shaneh
2024-03-22 19:07       ` Pedro Alves
  -- strict thread matches above, loose matches on Subject: below --
2016-01-20 15:54 Jon Turney
2016-01-20 16:19 ` Pedro Alves
2016-03-09 17:49   ` Jon Turney
2016-03-09 18:09     ` Pedro Alves

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=87sf0jeidy.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jon.turney@dronecode.org.uk \
    --cc=orgads@gmail.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