3 ms·
This is the most common form of error handling used in the Linux kernel (at least the parts I look at). Although you'd normally have one error label for each al
by mkipper 5y ago
This is the most common form of error handling used in the Linux kernel (at least the parts I look at). Although you'd normally have one error label for each allocation in reverse order, so you can jump to the cleanup step for the most recently allocated resource and pass through the other labels and clean them up as well. So in your example, it would be something like:
bail_string1:
CFRelease(string1);
bail_string0:
CFRelease(string0);
bail_array:
CFRelease(arrayObj);
no_bail:
return thing;