From patchwork Sun Apr 9 16:12:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChunYu Wang X-Patchwork-Id: 9671585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B43D5601EA for ; Sun, 9 Apr 2017 16:12:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5F3D27D29 for ; Sun, 9 Apr 2017 16:12:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 987EE28329; Sun, 9 Apr 2017 16:12:24 +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=-6.9 required=2.0 tests=BAYES_00,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 3E0DD27D29 for ; Sun, 9 Apr 2017 16:12:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752355AbdDIQMX (ORCPT ); Sun, 9 Apr 2017 12:12:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39136 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752230AbdDIQMW (ORCPT ); Sun, 9 Apr 2017 12:12:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7B053D945 for ; Sun, 9 Apr 2017 16:12:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D7B053D945 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=chunwang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D7B053D945 Received: from localhost (unknown [10.66.61.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5247483C08; Sun, 9 Apr 2017 16:12:21 +0000 (UTC) From: ChunYu Wang To: steved@redhat.com Cc: linux-nfs@vger.kernel.org, yoyang@redhat.com, jiyin@redhat.com, ChunYu Wang Subject: [PATCH] nfs-server-generator: fix a potential memory leak issue Date: Mon, 10 Apr 2017 00:12:08 +0800 Message-Id: <1491754328-28518-1-git-send-email-chunwang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sun, 09 Apr 2017 16:12:22 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: ChunYu Wang --- Fix a potential memory leak issue caused by unfree pathname 'path'. systemd/nfs-server-generator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c index 4aa6509..441cec5 100644 --- a/systemd/nfs-server-generator.c +++ b/systemd/nfs-server-generator.c @@ -139,6 +139,7 @@ int main(int argc, char *argv[]) strcat(path, filebase); f = fopen(path, "w"); if (!f) + free(path); exit(1); fprintf(f, "# Automatically generated by nfs-server-generator\n\n[Unit]\n");