[PATCH v2 2/3] virsh-domain: Fix @ret handling in cmdSetmem and cmdSetmaxmem

Peter Krempa pkrempa at redhat.com
Wed May 19 13:01:59 UTC 2021


On Wed, May 19, 2021 at 12:16:56 +0200, Michal Privoznik wrote:
> These functions initialize @ret to true and only after something
> fails either they call cleanup code (which consists only from
> virshDomainFree()) and return false, or they set ret = false and
> carry on (when the failure occurred close to cleanup code).
> 
> Switch them to the usual pattern in which ret is initialized to
> failure, goto cleanup is used and ret is set to true only after
> everything succeeded.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tools/virsh-domain.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list