qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] fsdev: Fix potential memory leak
Date: Sun, 07 Jul 2013 21:41:52 +0200	[thread overview]
Message-ID: <51D9C480.8020307@weilnetz.de> (raw)
In-Reply-To: <87y59i9tq2.fsf@linux.vnet.ibm.com>

Am 07.07.2013 19:15, schrieb Aneesh Kumar K.V:
> Stefan Weil <sw@weilnetz.de> writes:
>
>> Am 16.06.2013 12:02, schrieb Stefan Weil:
>>> This leak was reported by cppcheck.
>>>
>>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>>> ---
>>>  fsdev/qemu-fsdev.c |    2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
>>> index 6eaf36d..ccfec13 100644
>>> --- a/fsdev/qemu-fsdev.c
>>> +++ b/fsdev/qemu-fsdev.c
>>> @@ -76,6 +76,8 @@ int qemu_fsdev_add(QemuOpts *opts)
>>>  
>>>      if (fsle->fse.ops->parse_opts) {
>>>          if (fsle->fse.ops->parse_opts(opts, &fsle->fse)) {
>>> +            g_free(fsle->fse.fsdev_id);
>>> +            g_free(fsle);
>>>              return -1;
>>>          }
>>>      }
>> Ping?
> Both the error path result in Qemu terminating right ? Do we really care
> about free in those case ?
>
> -aneesh


Yes, we do, because it simplifies code reviews if there are
as few as possible warnings from static code analysers.

It is also not immediately obvious that QEMU terminates
in the code which was patched here. Reviewers have
to grep and look in vl.c, too, to see this.

Therefore I'd appreciate if this and similar code could be
fixed (with low priority here).

Regards
Stefan W.

  reply	other threads:[~2013-07-07 19:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16 10:02 [Qemu-devel] [PATCH] fsdev: Fix potential memory leak Stefan Weil
2013-07-02 20:35 ` Stefan Weil
2013-07-07 17:15   ` Aneesh Kumar K.V
2013-07-07 19:41     ` Stefan Weil [this message]
2013-07-04  4:54 ` M. Mohan Kumar
2013-07-10 19:33 ` Anthony Liguori

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=51D9C480.8020307@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=aliguori@us.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).