On 06/22/2015 01:26 PM, Markus Armbruster wrote: > requester.cpp uses this pattern to receive an error and pass it on to > the caller (err_is_set() macro peeled off for clarity): > > ... code that may set errset->errp ... > if (errset->errp && *errset->errp) { > ... handle error ... > } > > This breaks when errset->errp is null. As far as I can tell, it > currently isn't, so this is merely fragile, not actually broken. > > The robust way to do this is to receive the error in a local variable, > then propagate it up, like this: > > Error *err = NULL; > > ... code that may set err ... > if (err) > ... handle error ... > error_propagate(errset->errp, err); > } > > See also commit 5e54769, 0f230bf, a903f40. > > Signed-off-by: Markus Armbruster <arm...@redhat.com> > --- > qga/vss-win32.c | 1 + > qga/vss-win32/requester.cpp | 3 ++- > qga/vss-win32/requester.h | 2 +- > 3 files changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature