[libvirt] [PATCH 1/9] util: json: Fix freeing of objects appended to virJSONValue

Ján Tomko jtomko at redhat.com
Fri Mar 30 20:48:03 UTC 2018


On Fri, Mar 30, 2018 at 12:59:08PM +0200, Peter Krempa wrote:
>It was not possible to determine whether virJSONValueObjectAddVArgs and
>the functions using it would consume a virJSONValue or not when used
>with the 'a' or 'A' modifier depending on when the loop failed.
>
>Fix this by passing in a pointer to the pointer so that it can be
>cleared once it's successfully consumed and the callers don't have to
>second-guess leaving a chance of leaking or double freeing the value
>depending on the ordering.
>
>Fix all callers to pass a double pointer too.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_agent.c        |  7 ++-----
> src/qemu/qemu_block.c        | 22 ++++++----------------
> src/qemu/qemu_command.c      |  2 +-
> src/qemu/qemu_monitor_json.c | 36 ++++++++++--------------------------
> src/util/virjson.c           | 10 +++++++---
> tests/qemublocktest.c        |  4 +---
> 6 files changed, 27 insertions(+), 54 deletions(-)
>

ACK

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


More information about the libvir-list mailing list