qom: Do not reuse errp after a possible error
commit4715d42efe8632b0f9d2594a80e917de45e4ef88
authorMarkus Armbruster <armbru@redhat.com>
Tue, 25 Aug 2015 18:00:45 +0000 (25 20:00 +0200)
committerAndreas Färber <afaerber@suse.de>
Sat, 19 Sep 2015 06:10:11 +0000 (19 08:10 +0200)
treeb4f6b4618a02b81357b471f8e3ddc521f1d0c45c
parentb12a84ce3c27e42c8f51c436aa196938d5cc2c71
qom: Do not reuse errp after a possible error

The argument for an Error **errp parameter must point to a null
pointer.  If it doesn't, and an error happens, error_set() fails its
assertion.

Instead of

    foo(foos, errp);
    bar(bars, errp);

you need to do something like

    Error *err = NULL;

    foo(foos, &err);
    if (err) {
        error_propagate(errp, err);
        goto out;
    }

    bar(bars, errp);
out:

Screwed up in commit 0e55884 (v1.3.0): property_get_bool().

Screwed up in commit 1f21772 (v2.1.0): object_property_get_enum() and
object_property_get_uint16List().

Screwed up in commit a8e3fbe (v2.4.0): property_get_enum(),
property_set_enum().

Found by inspection, no actual crashes observed.

Fix them up.

Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Hu Tao <hutao@cn.fujitsu.com>
Cc: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
qom/object.c