From: ChunYu Wang <chunwang@redhat.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: Jianhong Yin <jiyin@redhat.com>,
Yongcheng Yang <yoyang@redhat.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs-server-generator: fix a potential memory leak issue
Date: Mon, 10 Apr 2017 11:09:30 +0800 [thread overview]
Message-ID: <CAA2bi78eQ9+7P9pbHHFbbOuPxUVuqpw4kbyH9txe0HqpMfMU9g@mail.gmail.com> (raw)
In-Reply-To: <7073c0d3-809f-4b7c-2b73-db0992dfc653@RedHat.com>
En, yes,
Thanks for reviewing and reminding, it is my fault [ : ( ].
Valgrind did not notice me about the syntax rationality, but it's my duty.
Get down to learn, and thanks a lot.
Regards,
ChunYu Wang
On Mon, Apr 10, 2017 at 2:33 AM, Steve Dickson <SteveD@redhat.com> wrote:
>
>
> On 04/09/2017 12:12 PM, ChunYu Wang wrote:
>> 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);
> First of all you need some '{' '}' so the process will not
> always exit when f != NULL...
>
> Secondly dead process don't leak memory. :-) They don't leak anything... they are died! ;-)
>
> steved.
>
>> fprintf(f, "# Automatically generated by nfs-server-generator\n\n[Unit]\n");
>>
>>
prev parent reply other threads:[~2017-04-10 3:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 16:12 [PATCH] nfs-server-generator: fix a potential memory leak issue ChunYu Wang
2017-04-09 18:33 ` Steve Dickson
2017-04-10 3:09 ` ChunYu Wang [this message]
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=CAA2bi78eQ9+7P9pbHHFbbOuPxUVuqpw4kbyH9txe0HqpMfMU9g@mail.gmail.com \
--to=chunwang@redhat.com \
--cc=SteveD@redhat.com \
--cc=jiyin@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--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.