This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: reset fileio


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]