fixed mem leaks
[swftools.git] / lib / as3 / main.c
index 04f25e9..09e2669 100644 (file)
@@ -40,7 +40,7 @@ void test_lexer()
         if(token>=32 && token<256) {
             printf("'%c'\n", token);
         } else {
-            printf("%s\n", token2string(avm2_lval));
+            printf("%s\n", token2string(token, avm2_lval));
         }
     }
 }
@@ -81,8 +81,8 @@ int main(int argn, char*argv[])
     swf.fileVersion = 9;
     swf.frameRate = 0x2500;
     swf.movieSize.xmin = swf.movieSize.ymin = 0;
-    swf.movieSize.xmax = 1024*20;
-    swf.movieSize.ymax = 768*20;
+    swf.movieSize.xmax = 20*20;
+    swf.movieSize.ymax = 10*20;
     TAG*tag = swf.firstTag = swf_InsertTag(0, ST_DOABC);
     swf_WriteABC(tag, code);
 
@@ -91,6 +91,7 @@ int main(int argn, char*argv[])
         swf_SetU16(tag, 1);
         swf_SetU16(tag, 0);
         swf_SetString(tag, globalclass);
+        free(globalclass);globalclass=0;
     } else {
         printf("Warning: no global public MovieClip subclass\n");
     }
@@ -104,5 +105,7 @@ int main(int argn, char*argv[])
     swf_WriteSWF(f,&swf);
     close(f);
 
+    swf_FreeTags(&swf);
+
     return 0;
 }