From: Florian Ragwitz Date: Sat, 13 Nov 2010 13:53:57 +0000 (+0100) Subject: Be explicit about refcounts, thereby fixing one leak X-Git-Tag: 0.14~42 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=93c3641704fd13c31076e8dc090405d5783100d4;p=gitmo%2FPackage-Stash-XS.git Be explicit about refcounts, thereby fixing one leak --- diff --git a/Stash.xs b/Stash.xs index f7d2c95..f66b4a7 100644 --- a/Stash.xs +++ b/Stash.xs @@ -278,9 +278,9 @@ new(class, package_name) hv_store(instance, "name", 4, package_name, 0); namespace = gv_stashpv(SvPV_nolen(package_name), GV_ADD); - hv_store(instance, "namespace", 9, newRV((SV*)namespace), 0); + hv_store(instance, "namespace", 9, newRV_noinc((SV*)namespace), 0); - RETVAL = sv_bless(newRV((SV*)instance), gv_stashpv(class, 0)); + RETVAL = sv_bless(newRV_inc((SV*)instance), gv_stashpv(class, 0)); OUTPUT: RETVAL @@ -462,7 +462,7 @@ get_package_symbol(self, variable) val = _get_package_symbol(self, &variable, 0); if (!val) XSRETURN_UNDEF; - RETVAL = newRV(val); + RETVAL = newRV_inc(val); OUTPUT: RETVAL @@ -476,7 +476,7 @@ get_or_add_package_symbol(self, variable) val = _get_package_symbol(self, &variable, 1); if (!val) XSRETURN_UNDEF; - RETVAL = newRV(val); + RETVAL = newRV_inc(val); OUTPUT: RETVAL