From patchwork Thu Feb 28 20:36:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 10833695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2028A13B5 for ; Thu, 28 Feb 2019 20:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1037C2F89A for ; Thu, 28 Feb 2019 20:36:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 035182F990; Thu, 28 Feb 2019 20:36:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 935262F89A for ; Thu, 28 Feb 2019 20:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731989AbfB1Ug5 (ORCPT ); Thu, 28 Feb 2019 15:36:57 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45404 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbfB1Ug4 (ORCPT ); Thu, 28 Feb 2019 15:36:56 -0500 Received: by mail-lj1-f195.google.com with SMTP id d24so18105314ljc.12 for ; Thu, 28 Feb 2019 12:36:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wzevuTmzh3+6HmlOxn0sKfe9mUKsnO5VUNpEsI06mQ4=; b=arNnzzRLqfPo6Z2gVuqr+FK2FLK35TIrhwCiFGwMxZl2/nSk0mNziS4KluVSJL1ptk NzQrlZIOPHgdKtr9g76LUQdLGZsW0OoJdPhieS3mpq8u19JmeCv3zu2vhTDhQGCxT0Eg +9eCU5TznbV0TTaqUFLvew+EqEDIZQ2gw5MgFGih9YdERdYQ2I/PDCih3vsFi7l81oa0 oKbbM2ZAdSrOZJtjwqhMNIxuCy4J6vYBhlKbY1xkohz4v2kZ2Bj8ntCF7XWMEcTaZO5N uF2+outKTMnUly/K7aNyC6C8uel/GRzy8xavj0CXRqy8enEEJXuV0+Pad9J2M5zSTrEY H08w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wzevuTmzh3+6HmlOxn0sKfe9mUKsnO5VUNpEsI06mQ4=; b=BAkVkby3nxshxTkGMzh9/tVeNXhyk6EAHL9P0YfUHAMUMGjzDiLtSAJ8xmB0ro3yyA isAMmVZPqLJbJ0MTg9sOcp7GZRP6T329/d1ujnKju1f4dduygdZysrlyI+yeBJ2XGnn/ WNxCYTbN+TBQ/j8uO/VUq3/sFpDpc5ukDtjbw8wq/vhnp/qx4VDDVlgOcGc2jV51zFIY IYNhHw8ZtSNpqfm8lMkUHFfG7TdBbOBUzNUia57IReuWx3TBrL+zxTc8Tm4iDjdra2AW 5UvOPQcwxFeWr/6xOkzaq7WG82LHjUZvqme21w1gdzG0SoEIxc05FWPCwXmJizuir0ik iE1w== X-Gm-Message-State: APjAAAULTzHApVniBllGV3QpJmy+BwudaDLpuMM707QncQI/cgGhSULw 3OW8ZRNVQcAlSiQvaRYwIHsknpam X-Google-Smtp-Source: APXvYqzS6DEVsuRjqYvx1aHRPt5QB8luuTtas12Vn83PBkISV/6Q+fD47tFhCTRyTO0q+0HxPq9lXQ== X-Received: by 2002:a2e:4290:: with SMTP id h16mr516205ljf.52.1551386214482; Thu, 28 Feb 2019 12:36:54 -0800 (PST) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id l11sm4282415lja.38.2019.02.28.12.36.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 12:36:53 -0800 (PST) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Jeff King , "brian m . carlson" Subject: [PATCH v4 1/2] setup: free old value before setting `work_tree` Date: Thu, 28 Feb 2019 21:36:27 +0100 Message-Id: <13019979b811d26f4838d09331c7ddd8223d270d.1551385992.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: <20190226174655.GE19606@sigill.intra.peff.net> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before assigning to `data->work_tree` in `read_worktree_config()`, free any value we might already have picked up, so that we do not leak it. Signed-off-by: Martin Ă…gren Signed-off-by: Junio C Hamano --- setup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.c b/setup.c index 1be5037f12..bb633942bb 100644 --- a/setup.c +++ b/setup.c @@ -411,6 +411,7 @@ static int read_worktree_config(const char *var, const char *value, void *vdata) } else if (strcmp(var, "core.worktree") == 0) { if (!value) return config_error_nonbool(var); + free(data->work_tree); data->work_tree = xstrdup(value); } return 0;