On Thu, Jan 24, 2013 at 12:42:38PM -0700, Zach Brown wrote:
>
> > > + if (sv_id == 5) {
> > > + printf("%s is btrfs root\n", fullpath);
> > > + close(fd);
> > > + close(mntfd);
> > > + free(mnt);
> > > + free(fullpath);
> > > + return 1;
> >
> > Just wondering, at this point might a "goto out;" be cleaner error
> > handling? Every error case is getting longer ;)
>
> No wondering needed! This pattern is a source of bugs. I'm hitting
> cases in the static analysis reports of people adding return paths
> without recognizing the pile of state they're expected to cleanup.
>
> Use safe unwinding in one exit path at the end, please. It's less
> maddening to audit and less likely to fail over time.
Really, goto is your friend ;)
-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html