Re: [Xen-devel] [PATCH v3 6/8] golang/xenlight: Don't leak memory on context open failure

2020-01-20 Thread Nick Rosbrook
> If libxl_ctx_alloc() returns an error, we need to destroy the logger > that we made. > > Restructure the Close() method such that it checks for each resource > to be freed and then frees it. This allows Close() to be come > idempotent, as well as to be a useful clean-up to a partially-created >

[Xen-devel] [PATCH v3 6/8] golang/xenlight: Don't leak memory on context open failure

2020-01-17 Thread George Dunlap
If libxl_ctx_alloc() returns an error, we need to destroy the logger that we made. Restructure the Close() method such that it checks for each resource to be freed and then frees it. This allows Close() to be come idempotent, as well as to be a useful clean-up to a partially-created context.