Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7158096ybi; Thu, 1 Aug 2019 04:06:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJufFoUj1iKO8QvtfusA4MNL55tHlI71A4BTNtrtqyBKgN2jfoMHdc1qAkg46piRS9UMmu X-Received: by 2002:a17:90a:2008:: with SMTP id n8mr7951852pjc.4.1564657601423; Thu, 01 Aug 2019 04:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564657601; cv=none; d=google.com; s=arc-20160816; b=Vn6NHwqxs8Var3Y7NXF9nPDojbDklvtbqV48GlIBW9dsGXpVDNSl45/9nT70ORCsW9 E/b8Ds7nIJeeJFiB3Vkat0HQ/U7oOooeysBapFhpc0gSYJN5DLvMCn1J/Mazj8/EZoDc EKagBzO7f7V5LLuXZET/a0c2QEs33gjwiDFFxpvEFeDk5pUQG+yN6gbcHtlo+5v67NtU ejMPnRRWRUfcLn761nRfBN0WadFgnHDL5D1sbrNS1DoPgF62vu4SH3tgg1mfG7MB9HdZ syZbkP7Gn8bkTq6PxhpBHpp1YzAatI98R5JFhAJfCPZ2oQuhfzIEv9Iy7BCanAbbsiAa v5gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:cc:to:from:subject:message-id; bh=2NMC2SXIbrIDohAo25J9oVRXfyar86t2fJeKyiOLv6Y=; b=KBYVqHw6xnf6EuTE5JoElwM7v/vc30K6bkqM++HbVZaThbKvHm2RczN+6gW42g8Ddr UvIuLFsyMF9ZrBNAqKX4Old4TkTfMnYDTQSSHyONzVBsiYone0R7WbVP0bCN8Z6jzGWt tusvCfLpG4Xe44e3PnMaWhvzMWgPyS8zfXjLmUMOnMhpM81wMBIQHFFK3iV/EPgF8dl3 SHq5QQNGAO7TQ//bzPWVt755bIktsH2E4wCojv4uQIt0C3szlpnfWfYMAhaUvbqE1uNy aShQ3H6RbtiqrVYc7D3Y8+0dqYVUvg69oqZAWB42xeYivLuJqli5epGw3XEJaM2/AgXi br+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si35182735pgh.159.2019.08.01.04.06.17; Thu, 01 Aug 2019 04:06:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731291AbfHAK7E (ORCPT + 99 others); Thu, 1 Aug 2019 06:59:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45541 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726756AbfHAK7E (ORCPT ); Thu, 1 Aug 2019 06:59:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 350443148090 for ; Thu, 1 Aug 2019 10:59:04 +0000 (UTC) Received: from jumitche.remote.csb (unknown [10.33.36.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89A8760BE0; Thu, 1 Aug 2019 10:59:03 +0000 (UTC) Message-ID: <1564657141.8625.7.camel@redhat.com> Subject: [PATCH] nfs-utils: Fix memory leak on error in nfs-server-generator From: Alice J Mitchell To: linux-nfs@vger.kernel.org Cc: Steve Dickson Date: Thu, 01 Aug 2019 11:59:01 +0100 Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 01 Aug 2019 10:59:04 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Fix the trivial memory leak in the error handling of nfs-server-generator Signed-off-by: Alice J Mitchell --- systemd/nfs-server-generator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c index 737f109..eec98fd 100644 --- a/systemd/nfs-server-generator.c +++ b/systemd/nfs-server-generator.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "misc.h" #include "nfslib.h" @@ -98,7 +99,7 @@ int main(int argc, char *argv[]) exit(1); } - path = malloc(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase)); + path = alloca(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase)); if (!path) exit(2); if (export_read(_PATH_EXPORTS, 1) + -- 1.8.3.1