Author: cotto
Date: Sun Dec 14 03:35:27 2008
New Revision: 33880

Modified:
   trunk/src/ops/core.ops

Log:
[ops] free string after using it, rather than before (CID #344, CID #345)


Modified: trunk/src/ops/core.ops
==============================================================================
--- trunk/src/ops/core.ops      (original)
+++ trunk/src/ops/core.ops      Sun Dec 14 03:35:27 2008
@@ -1357,7 +1357,6 @@
 op dlvar(out PMC, invar PMC, in STR) {
     char * const name = string_to_cstring(interp, ($3));
     void * const p = Parrot_dlsym(PMC_IS_NULL($2) ? NULL : PMC_data($2), name);
-    string_cstring_free(name);
     if (p == NULL) {
         const char * const err = Parrot_dlerror();
         Parrot_warn(interp, PARROT_WARNINGS_UNDEF_FLAG,
@@ -1370,6 +1369,7 @@
         $1 = pmc_new(interp, enum_class_UnManagedStruct);
         PMC_data($1) = p;
     }
+    string_cstring_free(name);
 }
 
 inline op compreg(in STR, invar PMC) {

Reply via email to