This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: reset fileio
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: dan at codesourcery dot com
- Cc: nathan at codesourcery dot com, gdb at sourceware dot org
- Date: Sat, 17 Jun 2006 22:04:30 +0200 (CEST)
- Subject: Re: reset fileio
- References: <4474131D.2080805@codesourcery.com> <20060524124120.GA25225@nevyn.them.org>
> Date: Wed, 24 May 2006 08:41:21 -0400
> From: Daniel Jacobowitz <dan@codesourcery.com>
>
> On Wed, May 24, 2006 at 09:02:37AM +0100, Nathan Sidwell wrote:
> > + /* Close any open descriptors, and reinitialize the file mapping */
>
> Period at the end of the comment.
>
> > + void
> > + remote_fileio_reset (void)
> > + {
> > + int ix;
> > +
> > + for (ix = 0; ix != remote_fio_data.fd_map_size; ix++)
> > + {
> > + int fd = remote_fio_data.fd_map[ix];
> > +
> > + if (fd >= 0)
> > + close (fd);
> > + }
> > + free (remote_fio_data.fd_map);
> > + remote_fio_data.fd_map = NULL;
> > + remote_fio_data.fd_map_size = 0;
> > + }
>
> Won't this free NULL if the target hadn't initialized fileio? I think
> that's non-portable.
That's why Nathan should use xfree() instead of free().
Mark