Skip to content

Instantly share code, notes, and snippets.

@tokuhirom
Created August 24, 2008 22:51
Show Gist options
  • Save tokuhirom/7013 to your computer and use it in GitHub Desktop.
Save tokuhirom/7013 to your computer and use it in GitHub Desktop.
=== MOP.xs
==================================================================
--- MOP.xs (revision 22684)
+++ MOP.xs (local)
@@ -127,10 +127,11 @@
/* BAH! constants are horrible */
key = HePV(he, keylen);
fqlen = pkglen + keylen + 3;
- fq = (char *)alloca(fqlen);
- snprintf(fq, fqlen, "%s::%s", package, key);
+ Newx(fq, fqlen, char);
+ sprintf(fq, "%s::%s", package, key);
sv = (SV*)get_cv(fq, 0);
sv_2mortal(sv);
+ Safefree(fq);
break;
default:
continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment