From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id OK3gDJeIQ2CIdwAA0tVLHw (envelope-from ) for ; Sat, 06 Mar 2021 13:50:15 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qHyHCJeIQ2CQIwAAbx9fmQ (envelope-from ) for ; Sat, 06 Mar 2021 13:50:15 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B3F7DA00F for ; Sat, 6 Mar 2021 14:50:14 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6661B27C2B; Sat, 6 Mar 2021 08:49:48 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id A136926BF0 for ; Sat, 6 Mar 2021 08:49:42 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 9AF5D5FA96; Sat, 6 Mar 2021 08:49:42 -0500 (EST) Received: (nullmailer pid 491402 invoked by uid 1000); Sat, 06 Mar 2021 13:49:37 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 1/4] lib/open: use local talloc context in n_d_create_with_config Date: Sat, 6 Mar 2021 09:49:31 -0400 Message-Id: <20210306134934.491249-2-david@tethera.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306134934.491249-1-david@tethera.net> References: <20210306134934.491249-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 4N7NIDO7Y4HJHT3IAQNDHZEGL6MWQX7W X-Message-ID-Hash: 4N7NIDO7Y4HJHT3IAQNDHZEGL6MWQX7W X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615038614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hYQ3xwzQie7t7oktoIuR8Qu/5pkM8eJkbeOtabbeli4=; b=EW3GO6So3u21COhRYBkhA3WZOHMv61FdW4sCaKK45qrzrdyPDvJ/XsDecgB+Hthqk5/bdb jP2M8zt5brODEy1b9tTJk0S7NoobY6POFAEOug0nxnXnaFoR+HX5nQ27NiP4FXsxsArx5K 9EhuzWs/bMVWd89TprkrgJeAuqMGWfW23oGe0qm69824SKMbdbMiC/T89L+H/lxD8muFW2 +aBfGuGuMQVGd7SADkkM9t59HAQ9AI8ewlv4vdPPKZVfDY3IovznrHn51mEIOsjl8Nd+e3 KFmyBDigwOK7/7AmrUCqWlS8JKd9VhmMx7dtg+0obeRIZs0ZVtG5w7Nq3kRLuA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615038614; a=rsa-sha256; cv=none; b=kb+mX0M1T9vljFFBVlfH1k+K5+mAaDvWqBKyAhF/1HQWf8DN+SG5lTCLHNyVrG05xlzZIE Y6utDLSp5WUjsPhfYDTB0MYE1wpMH+sVyUmc6QYdpYaNpaWoIvOSEIJooXxJWcH3HCgROg n7NYnwpSzNdGTtGhANErMgiWI0ErFZdr4IJnRA7s+Q376rQovJdblrzx2Q7Zof8rrliw+m UvXFMrIJeMzKy96IbngVhz4c+gVsO7tBYVhiZ7z4IsOlmLXflND5nt6GxfjUQq9VBX1eRI svzxl+OLRrFj7SIjhAcoXQYIeLkQnv7cjyr/TZ8F88AZqlYwA7Xt8/MivNozTA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.07 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: B3F7DA00F X-Spam-Score: -1.07 X-Migadu-Scanner: scn0.migadu.com X-TUID: Jb5zZGEa/R/x This better matches the memory allocation semantics in notmuch_database_open_with_config. --- lib/open.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index 3b86065b..3b66d2eb 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -423,6 +423,7 @@ notmuch_database_create_with_config (const char *database_path, GKeyFile *key_file = NULL; struct stat st; int err; + void *local = talloc_new (NULL); if ((status = _choose_database_path (config_path, profile, &key_file, &database_path, &message))) goto DONE; @@ -443,7 +444,7 @@ notmuch_database_create_with_config (const char *database_path, goto DONE; } - notmuch_path = talloc_asprintf (NULL, "%s/%s", database_path, ".notmuch"); + notmuch_path = talloc_asprintf (local, "%s/%s", database_path, ".notmuch"); err = mkdir (notmuch_path, 0755); if (err) { @@ -479,8 +480,7 @@ notmuch_database_create_with_config (const char *database_path, } DONE: - if (notmuch_path) - talloc_free (notmuch_path); + talloc_free (local); if (message) { if (status_string) -- 2.30.1