Fix leak when setting a fully-qualified name
Dagfinn Ilmari Mannsåker [Mon, 4 Aug 2014 15:13:14 +0000 (16:13 +0100)]
Name.xs

diff --git a/Name.xs b/Name.xs
index 20c9b71..5d36d14 100644 (file)
--- a/Name.xs
+++ b/Name.xs
@@ -59,7 +59,9 @@ subname(name, sub)
        }
        s--;
         if (end) {
-               stash = GvHV(gv_fetchpv(savepvn(name, end - name), TRUE, SVt_PVHV));
+               char *namepv = savepvn(name, end - name);
+               stash = GvHV(gv_fetchpv(namepv, TRUE, SVt_PVHV));
+               Safefree(namepv);
                 name = end;
         }
        gv = (GV *) newSV(0);