On Mon, 2015-10-26 at 10:40 +0000, Wei Liu wrote:

> > +           return -1;
> 
> And, please set rv to a proper error code (presumably ENOMEM)

Please don't, xc_* functions should return -1 or NULL and set errno on
failure. (libxc error reporting is a bit of a mess, but this is the
intention).

So the caller here can assume that errno has already been set to something
appropriate (probably ENOMEM) and it is fine to translate the NULL into a 
-1 since the overall function returns an int not a pointer.

>  and use goto err, otherwise you're leaking xs_fd.

This is good advise and implies that rv should be set to -1 before the
goto.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to