[libvirt] [PATCHv2 2/7] qemu: monitor: Sanitize control flow in qemuMonitorSetCapabilities

Jiri Denemark jdenemar at redhat.com
Wed Apr 15 08:25:48 UTC 2015


On Tue, Apr 14, 2015 at 18:05:06 +0200, Peter Krempa wrote:
> ---
>  src/qemu/qemu_monitor.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index 398c236..fcdd41d 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -1527,7 +1527,6 @@ qemuMonitorEmitSerialChange(qemuMonitorPtr mon,
>  int
>  qemuMonitorSetCapabilities(qemuMonitorPtr mon)
>  {
> -    int ret;
>      VIR_DEBUG("mon=%p", mon);
> 
>      if (!mon) {
> @@ -1536,16 +1535,10 @@ qemuMonitorSetCapabilities(qemuMonitorPtr mon)
>          return -1;
>      }
> 
> -    if (mon->json) {
> -        ret = qemuMonitorJSONSetCapabilities(mon);
> -        if (ret < 0)
> -            goto cleanup;
> -    } else {
> -        ret = 0;
> -    }
> +    if (!mon->json)
> +        return 0;
> 
> - cleanup:
> -    return ret;
> +    return qemuMonitorJSONSetCapabilities(mon);
>  }

ACK

Jirka




More information about the libvir-list mailing list