Unix Technical Forum

Re: interface groups

This is a discussion on Re: interface groups within the mailing.openbsd.tech forums, part of the OpenBSD category; --> On Wed, 2004-06-23 at 13:52, David Gwynne wrote: > On Wed, 2004-06-23 at 13:32, Artur Grabowski wrote: > > ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 08:05 AM
David Gwynne
 
Posts: n/a
Default Re: interface groups

On Wed, 2004-06-23 at 13:52, David Gwynne wrote:
> On Wed, 2004-06-23 at 13:32, Artur Grabowski wrote:
> > Henning Brauer <lists-openbsdtech@bsws.de> writes:
> >
> > > * Philipp Buehler <pb@openbsd.org> [2004-06-22 10:06]:
> > > > + TAILQ_FOREACH(ifgp, &ifp->if_groups, group_list) {
> > > > + TAILQ_REMOVE(&ifp->if_groups, ifgp, group_list);
> > >
> > > no... see manpage
> > >
> > > NOTES
> > > Trying to free a list in the following way is a common error:
> > >
> > > LIST_FOREACH(var, head, entry)
> > > free(var);
> > > free(head);
> > >
> > > Since var is free'd, the FOREACH() macro refers to a pointer that may
> > > have been reallocated already. Proper code needs a second variable.
> > >
> > > for (var = LIST_FIRST(head); var != LIST_END(head); var = nxt) {
> > > nxt = LIST_NEXT(var, entry);
> > > free(var);
> > > }
> > > LIST_INIT(head); /* to put the list back in order */

> >
> > Stop giving bad advice.
> >
> > while ((foo = TAILQ_FIRST(..)) != NULL) {
> > TAILQ_REMOVE(foo ...);
> > free(foo);
> > }

>
> Hennings advice is good if you're not removing every entry in the list
> as you loop through it.
>


Actually, here is a good example of applying the advice Henning gave:
http://www.itee.uq.edu.au/~chrisp/Op...ter_free2.diff

This applies against current and fixes a panic that is obviously very
rare since no one except Chris seems to have triggered it.

DG

> >
> > //art
> >





--
Scanned and found clear by entirescan http://www.entirescan.com/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com