Re: [PATCH] ACPI: scan: Fix a memory leak in an error handling path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 10, 2021 at 07:18:14AM -0600, Edmundo Carmona Antoranz wrote:
> On Sun, May 9, 2021 at 11:40 PM Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> wrote:
> 
> >
> > The best way to write error handling is "free the last resource style"
> > where you free the most recent resouce that was successfully allocated.
> > That way in your head you just have to keep track of one thing, instead
> > of tracking everything.
> >
> 
> IC. So the answer is rather: single place to free stuff? Yes..... _but_ in
> a layered fashion (through tags) instead of having a single tag to take
> care of everything.
> 
> Follow up question: is it worth making a patch to try to simplify a
> function to have error handling set up this way for code that is already
> working? Or not really?
> 

No, absolutely not.  This is just my preference and probably the most
common way to write error handling but it's not an official standard.

Plus it super easy to find error handling code which is not working and
fix that instead.

regards,
dan carpenter




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux