All of lore.kernel.org
 help / color / mirror / Atom feed
From: ChunYu Wang <chunwang@redhat.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org, yoyang@redhat.com, jiyin@redhat.com,
	ChunYu Wang <chunwang@redhat.com>
Subject: [PATCH] nfs-server-generator: fix a potential memory leak issue
Date: Mon, 10 Apr 2017 00:12:08 +0800	[thread overview]
Message-ID: <1491754328-28518-1-git-send-email-chunwang@redhat.com> (raw)

Signed-off-by: ChunYu Wang <chunwang@redhat.com>
---
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");
 
-- 
2.7.4


             reply	other threads:[~2017-04-09 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 16:12 ChunYu Wang [this message]
2017-04-09 18:33 ` [PATCH] nfs-server-generator: fix a potential memory leak issue Steve Dickson
2017-04-10  3:09   ` ChunYu Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491754328-28518-1-git-send-email-chunwang@redhat.com \
    --to=chunwang@redhat.com \
    --cc=jiyin@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    --cc=yoyang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.