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_accept.promela
aio_notify_bug.promela
aio_notify.promela
atomics.txt
bitmaps.md
blkdebug.txt
blkverify.txt
bootindex.txt
build-system.txt
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
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
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
qmp-spec.txt qapi: Update docs to match recent generator changes 2016-03-05 10:41:16 +01:00
rcu.txt
rdma.txt
replay.txt replay: introduce block devices record/replay 2016-03-30 12:15:57 +02:00
spice-port-fqdn.txt
throttle.txt
tracing.txt docs: Update documentation for stderr (now log) tracing backend. 2016-03-31 09:48:59 +01:00
usb2.txt
usb-storage.txt
virtio-balloon-stats.txt
virtio-migration.txt
vnc-ledstate-Pseudo-encoding.txt
win32-qemu-event.promela
writing-qmp-commands.txt
xbzrle.txt
xen-save-devices-state.txt