[notmuch] [PATCH] notmuch-count: make sure all created items are freed, even in error paths
Carl Worth
cworth at cworth.org
Fri Nov 27 05:01:40 PST 2009
On Tue, 24 Nov 2009 16:22:02 +0200, Dirk-Jan C. Binnema <djcb.bulk at 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
More information about the notmuch
mailing list