diff mbox

test-qmp-commands reads freed memory

Message ID 20140308110933.28374e9a@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino March 8, 2014, 4:09 p.m. UTC
On Sat, 8 Mar 2014 14:40:27 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:

> The test-qmp-commands test binary seems to read from freed
> memory. This triggers the MacOSX malloc implementation's
> assertions. git bisect blames

Can you try the patch below? For the clang ones, I'll have to install it etc,
so it will take a bit longer.

I wonder how this didn't explode...

Comments

Peter Maydell March 8, 2014, 4:41 p.m. UTC | #1
On 8 March 2014 16:09, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> On Sat, 8 Mar 2014 14:40:27 +0000
> Peter Maydell <peter.maydell@linaro.org> wrote:
>
>> The test-qmp-commands test binary seems to read from freed
>> memory. This triggers the MacOSX malloc implementation's
>> assertions. git bisect blames
>
> Can you try the patch below? For the clang ones, I'll have to install it etc,
> so it will take a bit longer.
>
> I wonder how this didn't explode...
>
> diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
> index 8e62c2d..554e222 100644
> --- a/tests/test-qmp-commands.c
> +++ b/tests/test-qmp-commands.c
> @@ -141,7 +141,7 @@ static void test_dispatch_cmd_io(void)
>
>      ret3 = qobject_to_qint(test_qmp_dispatch(req));
>      assert(qint_get_int(ret3) == 66);
> -    QDECREF(ret);
> +    QDECREF(ret3);
>
>      QDECREF(req);
>  }

Yep, seems to work (both MacOSX and valgrind are happier).

Tested-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
diff mbox

Patch

diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index 8e62c2d..554e222 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -141,7 +141,7 @@  static void test_dispatch_cmd_io(void)
 
     ret3 = qobject_to_qint(test_qmp_dispatch(req));
     assert(qint_get_int(ret3) == 66);
-    QDECREF(ret);
+    QDECREF(ret3);
 
     QDECREF(req);
 }