Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1462397
| From | Jonathan Corbet <corbet@lwn.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] CodingStyle: Clarify and complete chapter 7 |
| Date | 2016-08-14 22:50 +0200 |
| Message-ID | <s6aw1-4AX-1@gated-at.bofh.it> (permalink) |
| References | <rYNbb-4vR-25@gated-at.bofh.it> <s68ue-3cX-17@gated-at.bofh.it> <s6a2Z-4oa-13@gated-at.bofh.it> |
| Organization | LWN.net |
On Sun, 14 Aug 2016 13:12:33 -0700 Mark D Rustad <mrustad@gmail.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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Jonathan Corbet <corbet@lwn.net> - 2016-08-14 20:40 +0200
Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Mark D Rustad <mrustad@gmail.com> - 2016-08-14 22:20 +0200
Re: [PATCH] CodingStyle: Clarify and complete chapter 7 Jonathan Corbet <corbet@lwn.net> - 2016-08-14 22:50 +0200
Re: CodingStyle: Clarify and complete chapter 7 SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-15 17:40 +0200
csiph-web