• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Easy mbuf_pullup Question (I hope)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easy mbuf_pullup Question (I hope)


  • Subject: Re: Easy mbuf_pullup Question (I hope)
  • From: Terry Lambert <email@hidden>
  • Date: Tue, 6 Feb 2007 16:25:36 -0800

On Feb 6, 2007, at 5:49 AM, Andrew Gallatin wrote:
And always assume the mbuf that comes back is a totally new one, and
never reference the old one again.  Else you'll be cursed with random,
hard to track down 'freeing free mbuf' panics like I was.

Can you file a kernel KPI bug so we can possibly track proactively fixing it to make this kind of coding error less likely?


It's really trivial to prevent this sort of thing by changing the API design, e.g. from:

	x_t *
	foo(x_t *xp)
	{
		...
		return(newxp);
	}

to something like:

x_t *
foo(x_t **xpp)
{
...
*xpp = NULL; /* destroy caller's pointer to prevent use of freed memory */
return(newxp);
}


to make you fail immediately on continuing to use the pointer that was foo()'s parameter, instead of failing at some random place later because of a "memory stomper".

Thanks,
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Easy mbuf_pullup Question (I hope)
      • From: Andrew Gallatin <email@hidden>
References: 
 >Easy mbuf_pullup Question (I hope) (From: Jones Curtis <email@hidden>)
 >Re: Easy mbuf_pullup Question (I hope) (From: email@hidden (Jun-ichiro itojun Hagino))
 >Re: Easy mbuf_pullup Question (I hope) (From: Andrew Gallatin <email@hidden>)

  • Prev by Date: Re: Sleeping in nanos
  • Next by Date: kernel mprotecting my stack?
  • Previous by thread: Re: Easy mbuf_pullup Question (I hope)
  • Next by thread: Re: Easy mbuf_pullup Question (I hope)
  • Index(es):
    • Date
    • Thread