After a serious amount of trial and error... I got it to stop
crashing and I fixed the leak
HV *hv; // hash
SV *FNsv; // scalar reference to the hash
SV *SVhv;
ENTER;
SAVETMPS;
FNsv = get_sv("main::_FN", GV_ADD);
save_item(FNsv); /* local $_FN */
hv = newHV(); // create new hash
SVhv = newRV_noinc((SV *) hv);
sv_setsv(FNsv, SVhv);
hv_store_string(hv, "name", cstr2sv(desc->proname));
PUTBACK;
FREETMPS;
LEAVE;
SvREFCNT_dec_current(SVhv);
The fix I found was to put SvREFCNT_dec_current *after*
PUTBACK/FREETMPS/LEAVE
if you do the SvREFCNT_dec_current prior.. then it leaks
If the trailing end of the code looks like this... you get a leak
SvREFCNT_dec_current(SVhv);
PUTBACK;
FREETMPS;
LEAVE;