[libvirt] [PATCH 0/9] json: Fix leak/double-free, clean up code and privatize virJSONValue

Peter Krempa pkrempa at redhat.com
Fri Mar 30 10:59:07 UTC 2018


Coverity was not wrong about the usage of 'a'/'A' modifiers for
virJSONValueObjectAddVArgs as noted in [1]. Fix the possible
leak/double-free, and add test to make sure it works as expected.

This series also cleans up direct access to attributes of virJSONValue
and in the end privatizes the implementation so that all users are
forced to use accessors.

Peter Krempa (9):
  util: json: Fix freeing of objects appended to virJSONValue
  tests: json: Validate that attribute values are properly stolen
  qemu: monitor: Use virJSONValueObjectKeysNumber in
    qemuMonitorJSONGetCPUModelExpansion
  qemu: agent: Avoid unnecessary JSON object type check
  json: Replace access to virJSONValue->type by virJSONValueGetType
  util: json: Add accessor for geting a VIR_JSON_TYPE_NUMBER as string
  util: qemu: Don't access virJSONValue members directly in
    virQEMUBuildCommandLineJSONRecurse
  qemu: monitor: Don't resist stealing 'actions' in
    qemuMonitorJSONTransaction
  util: json: Privatize struct _virJSONValue and sub-structs

 src/libvirt_private.syms     |  1 +
 src/qemu/qemu_agent.c        | 21 +++++-----------
 src/qemu/qemu_block.c        | 22 +++++------------
 src/qemu/qemu_command.c      |  2 +-
 src/qemu/qemu_driver.c       |  4 +--
 src/qemu/qemu_monitor.c      |  4 +--
 src/qemu/qemu_monitor.h      |  2 +-
 src/qemu/qemu_monitor_json.c | 59 ++++++++++++++------------------------------
 src/qemu/qemu_monitor_json.h |  2 +-
 src/util/virjson.c           | 59 +++++++++++++++++++++++++++++++++++++++++---
 src/util/virjson.h           | 39 +----------------------------
 src/util/virqemu.c           | 13 ++++++----
 tests/qemublocktest.c        |  4 +--
 tests/virjsontest.c          | 47 +++++++++++++++++++++++++++++++++++
 14 files changed, 152 insertions(+), 127 deletions(-)

-- 
2.16.2




More information about the libvir-list mailing list