|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/8] tools/libvchan: init_xs_srv: Simplify error handling (1)
On Fri, Nov 02, 2018 at 05:01:08PM +0000, Ian Jackson wrote:
> * Use xs_close instead of the deprecated xs_daemon_close.
>
> * Initialise xs to NULL. That means xs_close can now be called in
> all cases. Move it to the fail clause.
>
> * free(domid_str) is already safe in all cases since domid_str is
> initialised to NULL. Move it to the fail clause.
>
> No overall functional change: xs_close is the same as xs_daemon_close;
> and it and free are now sometimes called on NULL, but those are no-ops.
>
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> ---
> tools/libvchan/init.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
> index 180833dc2f..9c61c720d1 100644
> --- a/tools/libvchan/init.c
> +++ b/tools/libvchan/init.c
> @@ -245,7 +245,7 @@ fail:
> static int init_xs_srv(struct libxenvchan *ctrl, int domain, const char*
> xs_base, int ring_ref)
> {
> int ret = -1;
> - struct xs_handle *xs;
> + struct xs_handle *xs = NULL;
> struct xs_permissions perms[2];
> char buf[64];
> char ref[16];
> @@ -292,9 +292,9 @@ retry_transaction:
> ret = 0;
> }
> fail_xs_open:
This label can be deleted now.
> - free(domid_str);
> - xs_daemon_close(xs);
> fail:
> + free(domid_str);
> + xs_close(xs);
> return ret;
> }
>
> --
> 2.11.0
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |