reset fileio
Mark Kettenis
mark.kettenis@xs4all.nl
Sat Jun 17 21:16:00 GMT 2006
> 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
More information about the Gdb
mailing list