Messages in this thread | ![/](/images/icornerl.gif) | | Date | Thu, 18 Apr 2024 20:08:21 +0200 | Subject | Re: [ 2/2] kunit: avoid memory leak on device register error | From | Markus Elfring <> |
| |
>> Common error handling code can be used instead >> if an additional label would be applied for a corresponding jump target. >> >> How do you think about to increase the application of scope-based resource management here? > > I thought about that. But I think the code is simple enough (for now) > to not require an exit label.
Please follow a known advice (besides other recommended improvements). https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
Regards, Markus
| ![\](/images/icornerr.gif) |