This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] source.c:find_and_open_source cleanup
- From: Daniel Jacobowitz <drow at false dot org>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 17 Apr 2008 11:58:40 -0400
- Subject: Re: [RFA] source.c:find_and_open_source cleanup
- References: <20080407193412.3CDC11C751F@localhost>
On Mon, Apr 07, 2008 at 12:34:12PM -0700, Doug Evans wrote:
> This is odd:
>
> if (result >= 0)
> {
> char *tmp_fullname;
> tmp_fullname = *fullname;
> *fullname = xstrdup (tmp_fullname);
> xfree (tmp_fullname);
> }
>
> Is there something subtle going on here?
> I thought maybe the caller might be expecting a newly allocated value
> if it passed in a value for `fullname', but the previous value has
> already been freed at this point.
>
> 2008-04-07 Doug Evans <dje@google.com>
>
> * source.c (find_and_open_source): Add some comments clarifying
> handling of FULLNAME argument. Make static. Remove pointless
> xstrdup/xfree.
Looks good to me. Please commit, thanks!
--
Daniel Jacobowitz
CodeSourcery