]> Git Repo - qemu.git/commit
qom: Fix invalid error check in property_get_str()
authorMarkus Armbruster <[email protected]>
Tue, 25 Aug 2015 18:00:46 +0000 (20:00 +0200)
committerAndreas Färber <[email protected]>
Sat, 19 Sep 2015 06:10:12 +0000 (08:10 +0200)
commite1c8237df5395f6a453f18109bd9dd33fb2a397c
tree61c1ceb62a882b7258b177c26fb7b41c37d4ed66
parent4715d42efe8632b0f9d2594a80e917de45e4ef88
qom: Fix invalid error check in property_get_str()

When a function returns a null pointer on error and only on error, you
can do

    if (!foo(foos, errp)) {
        ... handle error ...
    }

instead of the more cumbersome

    Error *err = NULL;

    if (!foo(foos, &err)) {
        error_propagate(errp, err);
        ... handle error ...
    }

A StringProperty's getter, however, may return null on success!  We
then fail to call visit_type_str().

Screwed up in 6a146eb, v1.1.

Fails tests/qom-test in my current, heavily hacked QAPI branch.  No
reproducer for master known (but I didn't look hard).

Cc: Anthony Liguori <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Cc: [email protected]
Signed-off-by: Andreas Färber <[email protected]>
qom/object.c
This page took 0.025305 seconds and 4 git commands to generate.