[libvirt] [PATCH libvirt-python 2/2] setPyVirTypedParameter: free whole return variable on error
Martin Kletzander
mkletzan at redhat.com
Tue Mar 18 09:16:13 UTC 2014
On Tue, Mar 18, 2014 at 09:26:09AM +0100, Michal Privoznik wrote:
> The @ret value is built in a loop. However, if in one iteration
> there's an error, we should free all the fields built so far. For
> instance, if there's an error and the previous item was
> type of VIR_TYPED_PARAM_STRING we definitely must free it.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> libvirt-override.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
ACK,
Martin
> diff --git a/libvirt-override.c b/libvirt-override.c
> index 3765a43..7f746ed 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -259,7 +259,7 @@ setPyVirTypedParameter(PyObject *info,
> return ret;
>
> cleanup:
> - VIR_FREE(ret);
> + virTypedParamsFree(ret, size);
> return NULL;
> }
>
> --
> 1.9.0
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140318/5b4876e3/attachment-0001.sig>
More information about the libvir-list
mailing list