From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
"open list:Block layer core" <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.6] crypto: Avoid memory leak on failure
Date: Fri, 1 Apr 2016 18:52:25 +0200 [thread overview]
Message-ID: <56FEA749.7080509@redhat.com> (raw)
In-Reply-To: <1459526222-30052-1-git-send-email-eblake@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]
On 01.04.2016 17:57, Eric Blake wrote:
> Commit 7836857 introduced a memory leak due to invalid use of
> Error vs. visit_type_end(). If visiting the intermediate
> members fails, we clear the error and unconditionally use
> visit_end_struct() on the same error object; but if that
> cleanup succeeds, we then skip the qapi_free call.
It's not really a memleak. Due to skipping those conditional branches
after the "out" label, a non-null value will be returned. In order to
determine whether the function call failed, the callers of these
functions do not use the errp value but the return value. Therefore,
they will think the call succeeded when actually it did not.
>
> Until a later patch adds visit_check_struct(), the only safe
> approach is to use two separate error objects.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> block/crypto.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Anyway, thanks, applied to my block branch:
https://github.com/XanClic/qemu/commits/block
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-04-01 16:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 15:57 [Qemu-devel] [PATCH for-2.6] crypto: Avoid memory leak on failure Eric Blake
2016-04-01 16:52 ` Max Reitz [this message]
2016-04-07 15:14 ` [Qemu-devel] [Qemu-block] " Markus Armbruster
2016-04-07 16:23 ` Eric Blake
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=56FEA749.7080509@redhat.com \
--to=mreitz@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--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).