[libvirt] [PATCH 2/9] tests: json: Validate that attribute values are properly stolen

Peter Krempa pkrempa at redhat.com
Fri Mar 30 11:11:15 UTC 2018


On Fri, Mar 30, 2018 at 12:59:09 +0200, Peter Krempa wrote:
> Make sure that the 'a' and 'A' modifiers for virJSONValueObjectAddVArgs
> behave correctly.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---

If you apply this patch without the fix first you get the following
error in valgrind:

$ ./run valgrind tests/virjsontest
==164888== Memcheck, a memory error detector
==164888== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==164888== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==164888== Command: /home/pipo/libvirt/tests/.libs/virjsontest
==164888== 
TEST: virjsontest
      ........................................ 40 
      .==164888== Invalid free() / delete / delete[] / realloc()
==164888==    at 0x4C2E1AB: free (vg_replace_malloc.c:530)
==164888==    by 0x4EBD808: virFree (viralloc.c:582)
==164888==    by 0x4EF6ACE: virJSONValueFree (virjson.c:382)
==164888==    by 0x4EF6AAC: virJSONValueFree (virjson.c:362)
==164888==    by 0x4EF88A1: virJSONValueObjectCreateVArgs (virjson.c:329)
==164888==    by 0x4EF894B: virJSONValueObjectCreate (virjson.c:344)
==164888==    by 0x10BDFB: testJSONObjectFormatSteal (virjsontest.c:446)
==164888==    by 0x10D74E: virTestRun (testutils.c:180)
==164888==    by 0x10B929: mymain (virjsontest.c:636)
==164888==    by 0x10E92F: virTestMain (testutils.c:1119)
==164888==    by 0x10CE58: main (virjsontest.c:656)
==164888==  Address 0x1ffefffa70 is on thread 1's stack
==164888==  in frame #6, created by testJSONObjectFormatSteal (virjsontest.c:434)
==164888== 
!..........                             52  FAIL

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180330/331caf8a/attachment-0001.sig>


More information about the libvir-list mailing list