[libvirt] [PATCH 11/23] Fix leak of iterators in virDBusMessageIterEncode

Eric Blake eblake at redhat.com
Wed Sep 25 16:45:00 UTC 2013


On 09/25/2013 08:51 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> If virDBusMessageIterEncode hits an OOM condition it often
> leaks the memory associated with the dbus iterator object
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---

>  
>  cleanup:
> +    while (nstack > 0) {
> +        DBusMessageIter *thisiter = iter;
> +        VIR_DEBUG("Popping iter=%p", iter);
> +        if (virDBusTypeStackPop(&stack, &nstack, &iter,
> +                                &types, &nstruct, &narray) < 0)
> +            goto cleanup;

I'm worried that this will infloop.  What guarantee do we have that
nstack reduces when virDBusTypeStackPop fails?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130925/80df355e/attachment-0001.sig>


More information about the libvir-list mailing list