[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [perl-Sys-Virt][PATCH] de-mortalize the return value from hv_delete



On Thu, Feb 23, 2012 at 02:14:17AM +0800, Guannan Ren wrote:
>    when calling block_stats() like $dom->block_stats(), it will reprot errors:
> 
>    Attempt to free unreferenced scalar: SV 0x2598498, Perl interpreter: 0x11a0010.
>    Attempt to free unreferenced scalar: SV 0x258c498, Perl interpreter: 0x11a0010.
>    This patch fix it.
> ---
>  Virt.xs |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/Virt.xs b/Virt.xs
> index e5d8438..9ef9715 100644
> --- a/Virt.xs
> +++ b/Virt.xs
> @@ -3358,6 +3358,7 @@ block_stats(dom, path, flags=0)
>                    field = "flush_reqs";
>                if (field) {
>                    SV *val = hv_delete(RETVAL, params[i].field, strlen(params[i].field), 0);
> +                  SvREFCNT_inc(val);
>                    (void)hv_store(RETVAL, field, strlen(field), val, 0);
>                }
>            }

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]