in reply to Re^2: Passing integer pointer in XS?
in thread Passing integer pointer in XS?

SV *sv = newSV(0); leaks. You want SV *sv;

The other issue is because I forgot to cast it. newRV_noinc(hv) should be newRV_noinc(MUTABLE_SV(hv)).

Fixed in original.