qemu-e2k/docs
Eric Blake 68ab47e4b4 qapi: Change visit_type_FOO() to no longer return partial objects
Returning a partial object on error is an invitation for a careless
caller to leak memory.  We already fixed things in an earlier
patch to guarantee NULL if visit_start fails ("qapi: Guarantee
NULL obj on input visitor callback error"), but that does not
help the case where visit_start succeeds but some other failure
happens before visit_end, such that we leak a partially constructed
object outside visit_type_FOO(). As no one outside the testsuite
was actually relying on these semantics, it is cleaner to just
document and guarantee that ALL pointer-based visit_type_FOO()
functions always leave a safe value in *obj during an input visitor
(either the new object on success, or NULL if an error is
encountered), so callers can now unconditionally use
qapi_free_FOO() to clean up regardless of whether an error occurred.

The decision is done by adding visit_is_input(), then updating the
generated code to check if additional cleanup is needed based on
the type of visitor in use.

Note that we still leave *obj unchanged after a scalar-based
visit_type_FOO(); I did not feel like auditing all uses of
visit_type_Enum() to see if the callers would tolerate a specific
sentinel value (not to mention having to decide whether it would
be better to use 0 or ENUM__MAX as that sentinel).

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1461879932-9020-25-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-05-12 09:47:55 +02:00
..
specs fw_cfg: Adopt /opt/RFQDN convention 2016-04-19 16:09:50 +02:00
aio_notify.promela
aio_notify_accept.promela
aio_notify_bug.promela
atomics.txt
bitmaps.md docs: update bitmaps.md 2015-11-17 18:35:56 +08:00
blkdebug.txt blkdebug: Merge hand-rolled and qapi BlkdebugEvent enum 2015-12-17 08:21:27 +01:00
blkverify.txt
bootindex.txt
build-system.txt docs: describe the QEMU build system structure / design 2015-09-25 12:20:18 +02:00
ccid.txt
ich9-ehci-uhci.cfg
image-fuzzer.txt
live-block-ops.txt
memory-hotplug.txt
memory.txt docs: fix typo in memory.txt 2016-04-08 00:07:43 +02:00
migration.txt postcopy: Remove the x- 2016-03-11 17:53:59 +05:30
multi-thread-compression.txt
multiple-iothreads.txt
multiseat.txt maint: remove / fix many doubled words 2015-09-11 10:21:38 +03:00
pci_expander_bridge.txt pxb: cleanup 2016-03-11 16:59:12 +02:00
q35-chipset.cfg
qapi-code-gen.txt qapi: Change visit_type_FOO() to no longer return partial objects 2016-05-12 09:47:55 +02:00
qcow2-cache.txt docs: document how to configure the qcow2 L2/refcount caches 2015-09-04 21:00:32 +02:00
qdev-device-use.txt
qemupciserial.inf
qmp-events.txt qmp event: Refactor QUORUM_REPORT_BAD 2016-03-14 16:46:43 +01:00
qmp-intro.txt docs: Move files from docs/qmp/ to docs/ 2015-10-12 18:44:53 +02:00
qmp-spec.txt qapi: Update docs to match recent generator changes 2016-03-05 10:41:16 +01:00
rcu.txt doc/rcu: fix g_free_rcu() usage example 2015-10-19 10:13:07 +02:00
rdma.txt
replay.txt replay: introduce block devices record/replay 2016-03-30 12:15:57 +02:00
spice-port-fqdn.txt
throttle.txt docs: Document the throttling infrastructure 2016-02-22 14:08:07 +01:00
tracing.txt docs: Update documentation for stderr (now log) tracing backend. 2016-03-31 09:48:59 +01:00
usb-storage.txt
usb2.txt
virtio-balloon-stats.txt
virtio-migration.txt virtio: add some migration doc 2015-10-22 14:34:48 +03:00
vnc-ledstate-Pseudo-encoding.txt
win32-qemu-event.promela qemu-thread: add a fast path to the Win32 QemuEvent 2015-09-24 20:52:28 +02:00
writing-qmp-commands.txt error: More error_setg() usage 2015-11-11 18:56:26 +01:00
xbzrle.txt
xen-save-devices-state.txt