From patchwork Mon Jan 14 18:34:55 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: 10763295 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 D462513B5 for ; Mon, 14 Jan 2019 18:35:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6FA529632 for ; Mon, 14 Jan 2019 18:35:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAE7629868; Mon, 14 Jan 2019 18:35:10 +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 684E729632 for ; Mon, 14 Jan 2019 18:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726764AbfANSfJ (ORCPT ); Mon, 14 Jan 2019 13:35:09 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39531 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfANSfJ (ORCPT ); Mon, 14 Jan 2019 13:35:09 -0500 Received: by mail-lf1-f68.google.com with SMTP id n18so8414lfh.6 for ; Mon, 14 Jan 2019 10:35:07 -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=qS3BNiSUt2fZfz0WCH9bVtrLjGAdEPGYhOcH46aAxdo=; b=haqqwqrhsBJzjl2IESdFjqgO7nDnt97WrFbm+gwfiSSypsdLCTQqrrzLJD5RbkY5Cf R567qvEwV7KefDnDPEUJnuOx5tahSLp1lOx/bIITs9boMBVh4NiyX6QJDfWbh644+9B5 PsQ61QnTxDQY++wNrXu5x9QVJwk+ZoGVTeGJpDVIBynTVndrpHTJxq0KYjcYnLg/tFW0 U5cCIIIh61cX+3ke7FqP+0VTlW+hSNO6+wx4Qd9P/qGvUu5o46xZwKv7AkM+EDhDerfO TaT/IQF8GwOk0gMbgOMiWDmAYTESmVPTmkrndcOveaDH9F/iq0f9TBAq+CLozMHrj/no fwHg== 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=qS3BNiSUt2fZfz0WCH9bVtrLjGAdEPGYhOcH46aAxdo=; b=olkQR4chUqCsNKleXitcYOblJHB69lKpWq61fLxLzJp/rq+GHgzR1wTa1DdBhWyfRj hB1SNtOjdmgdBuhh15U1e9r9mza8e9jBNktizsj1AuVi1FkrwGFt4P7PJopLzGHja35u GENHiYW0KbFVcgTOqYjdvQbaqy40kiUE9QQYo80wQ7+ECnQAwPIlzSA6Xv9d0F2XJfz8 J5Zqzdh4LQ2wj5WXTtzspcorrm+u/UTLTfTDR3OlKr9EbPX5HGnzYh4Xz3TDIhtge6Xe nLSRohR4j0ABaA5VaGPozktvr1+Rb4+lqBJ3VSDI2sbCZtul9vGKtYz6MUqQEHjiV0jY C5yg== X-Gm-Message-State: AJcUukfIZ4ujMCXMn8RnRgPiyA2mwX7e/fMOLHNYKjYRctiwXBEgykQA 5jwM65zXjrJ/9qd8WBaHocsg1b/b X-Google-Smtp-Source: ALg8bN7LsDYrsRqaTLTK3s2jLK/bB8jHDz8SvvAEorAhrr1kbVuwCb33kOcy8WVQdZ1vLxbi1w3UXw== X-Received: by 2002:a19:7352:: with SMTP id o79mr15329853lfc.104.1547490906601; Mon, 14 Jan 2019 10:35:06 -0800 (PST) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id x24-v6sm224492ljc.54.2019.01.14.10.35.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 10:35:06 -0800 (PST) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Jeff King , "brian m . carlson" Subject: [PATCH v2 1/3] setup: free old value before setting `work_tree` Date: Mon, 14 Jan 2019 19:34:55 +0100 Message-Id: <8585c0bfdc071f17e75346b801a16580d360c18a.1547488709.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: <20181218072528.3870492-1-martin.agren@gmail.com> 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 --- 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;