unicorn/qemu/include
Eric Blake 2f42c2c195
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).

Backports commit 68ab47e4b4ecc1c4649362b8cc1e49794d1a6537 from qemu
2018-02-23 19:53:17 -05:00
..
crypto Drop unused crypto source files 2018-02-17 15:23:57 -05:00
exec exec-all: Remove externs 2018-02-23 12:43:03 -05:00
fpu fpu: Remove use of int_fast16_t in conversions to int16 2018-02-20 16:54:04 -05:00
hw qom: Allow properties to be registered against classes 2018-02-21 21:00:56 -05:00
qapi qapi: Change visit_type_FOO() to no longer return partial objects 2018-02-23 19:53:17 -05:00
qemu util: Fix MIN_NON_ZERO 2018-02-23 14:09:44 -05:00
qom include/qemu/osdep.h: Don't include qapi/error.h 2018-02-21 23:08:18 -05:00
sysemu oslib-win32: Change return type of function getpagesize 2018-02-17 19:10:37 -05:00
config.h
elf.h fix merge conflicts 2017-03-10 21:04:33 +08:00
glib_compat.h glib_compat: backport hashtable iterator interfaces 2018-02-21 13:18:44 -05:00
qemu-common.h util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00