unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] lib/open: fix leaks calling _trial_open
@ 2021-03-27 12:20 David Bremner
  0 siblings, 0 replies; only message in thread
From: David Bremner @ 2021-03-27 12:20 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

_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.
---
 lib/open.cc | 6 ++++++
 1 file changed, 6 insertions(+)

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,
-- 
2.30.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-27 12:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 12:20 [PATCH] lib/open: fix leaks calling _trial_open David Bremner

unofficial mirror of notmuch@notmuchmail.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/notmuch/0 notmuch/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 notmuch notmuch/ https://yhetil.org/notmuch \
		notmuch@notmuchmail.org
	public-inbox-index notmuch

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.notmuch.general
	nntp://news.gmane.io/gmane.mail.notmuch.general


code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git