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

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

 



   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);
               }
           }
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]