sharp memory leak
tharbaugh at lnxi.com
Thu Feb 13 11:02:52 EST 2003
Content-Type: text/plain; charset=ISO-8859-1
On Thu, 2003-02-13 at 01:59, J=F6rn Engel wrote:
> On Wed, 12 February 2003 10:55:20 -0700, Thayne Harbaugh wrote:
> > I've been sitting on some patches for a while and have not sent them
> > in. I saw Jorn send in the patch for the missing cfi_cmdset_0020 and
> > decided that I need to get my submissions in befor Jorn sends all of
> > them in.
> At least you allowed me to fix my own bug. I submitted cfi_cmdset_0020
> a while ago and forgot the Makefile line. Darn!
> > Here's just one - it's a memory leak in the sharp driver. It's not hug=
> > and will likely never leak, but it needs to be there to balance the
> > kmalloc().
> Leak exists and fix is correct. It may also be worthwhile to do the
> following instead:
> mtd =3D kmalloc
> if (!mtd)
> goto out1;
> sharp =3D kmalloc
> if (!sharp)
> goto out2;
> width =3D kmalloc
> if (!width)
> goto out3;
> return mtd;
> return NULL;
> Dunno, this is not a perfect candidate for that strategy, but it might
> be slightly more obvious. You decide.
I mostly don't care. I'm not even using the sharp driver - I was just
jumping in and looking around the MTD tree so that I could get up to
speed. I looked around at some examples and noticed that something was
not right with the sharp kalloc/kfree pairing.
In short, you make the decision and commit it - I'm just browsing and am
initially just mentioning what I have come across.
Thanks for the feedback.
BTW, my personal style is the same as what you have suggested above. It
is a bit cleaner and easier to follow for unwinding - IMHO.
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----
More information about the linux-mtd