aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-03-27 09:12:28 -0300
committerDavid Bremner <david@tethera.net>2021-03-27 09:12:28 -0300
commit4a8d67e357ff9bfe6ab7612ba052b72b9dcffa3f (patch)
treedd3a131dc8c22ed1f10ebeee270c28654006abbc /lib
parent4e209ca99ac8084a357c6fc8d7773f6207cfa16d (diff)
lib/open: fix leaks calling _trial_open
_trial_open can't know if the PATH_ERROR return value will cause the error message to be returned from the library, so it's up the caller to clean up if not.
Diffstat (limited to 'lib')
-rw-r--r--lib/open.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/open.cc b/lib/open.cc
index 8f572b0b..dc191d64 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -280,6 +280,9 @@ _notmuch_choose_xapian_path (void *ctx, const char *database_path,
if (status != NOTMUCH_STATUS_PATH_ERROR)
goto DONE;
+ if (*message_ptr)
+ free (*message_ptr);
+
notmuch_path = talloc_asprintf (ctx, "%s/.notmuch", database_path);
status = _db_dir_exists (notmuch_path, message_ptr);
if (status)
@@ -648,6 +651,9 @@ notmuch_database_create_with_config (const char *database_path,
goto DONE;
}
+ if (message)
+ free (message);
+
status = _finish_open (notmuch,
profile,
NOTMUCH_DATABASE_MODE_READ_WRITE,