Re: [notmuch] [PATCH] notmuch-count: make sure all created items are freed, even in error paths

Subject: Re: [notmuch] [PATCH] notmuch-count: make sure all created items are freed, even in error paths

Date: Fri, 27 Nov 2009 05:01:40 -0800

To: djcb@djcbsoftware.nl, notmuch@notmuchmail org

Cc:

From: Carl Worth


On Tue, 24 Nov 2009 16:22:02 +0200, Dirk-Jan C. Binnema <djcb.bulk@gmail.com> wrote:
> 
> Another minor patch, fixing a couple of resource leaks in error paths.

Thanks, Dirk-Jan, but we don't actually need this kind of care in some
cases, because these aren't leaks in a permanent sense since they are
talloc-based. Instead these "leaks" simply mean that on the error paths
these objects will live slightly longer than normal, until the caller
frees the talloc context.

And I'm perfectly happy to have slightly longer-lived objects in the
error paths, (while still guaranteeing leak-free behavior in all
cases). And I definitely like the easier-to-read-and-verify code that
comes with the early return values.

Now, we do have to be careful if there are side effects from having an
object live longer, (such as holding a database write lock or
something). So if there's a fix for something like that in an error
path, then yes, we'll definitely want that.

-Carl

Thread: