[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160814144543.1a12bced@lwn.net>
Date: Sun, 14 Aug 2016 14:45:43 -0600
From: Jonathan Corbet <corbet@....net>
To: Mark D Rustad <mrustad@...il.com>
Cc: Jean Delvare <jdelvare@...e.de>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Markus Elfring <elfring@...rs.sourceforge.net>
Subject: Re: [PATCH] CodingStyle: Clarify and complete chapter 7
On Sun, 14 Aug 2016 13:12:33 -0700
Mark D Rustad <mrustad@...il.com> wrote:
> >> + err:
> >> kfree(foo->bar);
> >> kfree(foo);
> >> return ret;
> >>
> >> The bug in this code is that on some exit paths "foo" is NULL. Normally the
> >
> > ...except that kfree() can handle null pointers just fine, so this isn't
> > actually a bug, right? Someday when somebody has time it would be good to
> > come up with a better example.
>
> But if foo is NULL, foo->bar is not NULL and so kfree will have a problem
> with it. So this is a bug.
Oops, sigh, duh. OK, ignore me. (Though technically kfree will not have a
problem with it, since things won't get that far.. :)
jon
Powered by blists - more mailing lists