[libvirt] [python PATCH] iothread: Fix crash if virDomainGetIOThreadInfo returns error

Erik Skultety eskultet at redhat.com
Thu Jul 30 07:49:51 UTC 2015



On 30/07/15 09:36, Peter Krempa wrote:
> The cleanup portion of libvirt_virDomainGetIOThreadInfo would try to
> clean the returned structures but the count of iothreads was set to -1.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248295
> ---
>  libvirt-override.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libvirt-override.c b/libvirt-override.c
> index 45c8afc..2398228 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -2104,8 +2104,10 @@ libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED,
>      py_iothrinfo = NULL;
> 
>  cleanup:
> -    for (i = 0; i < niothreads; i++)
> -        virDomainIOThreadInfoFree(iothrinfo[i]);
> +    if (niothreads > 0) {
> +        for (i = 0; i < niothreads; i++)
> +            virDomainIOThreadInfoFree(iothrinfo[i]);
> +    }
>      VIR_FREE(iothrinfo);
>      Py_XDECREF(py_iothrinfo);
>      return py_retval;
> 
ACK

Erik




More information about the libvir-list mailing list