[前][次][番号順一覧][スレッド一覧]

ruby-changes:6782

From: mame <ko1@a...>
Date: Fri, 1 Aug 2008 00:45:17 +0900 (JST)
Subject: [ruby-changes:6782] Ruby:r18297 (trunk): * ext/syck/syck.c (syck_free_parser): fix memory leak by

mame	2008-08-01 00:44:51 +0900 (Fri, 01 Aug 2008)

  New Revision: 18297

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18297

  Log:
    * ext/syck/syck.c (syck_free_parser): fix memory leak by
      YAML::Syck.compile.

  Modified files:
    trunk/ChangeLog
    trunk/ext/syck/syck.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18296)
+++ ChangeLog	(revision 18297)
@@ -1,3 +1,8 @@
+Wed Jul 30 21:08:06 2008  Yusuke Endoh  <mame@t...>
+
+	* ext/syck/syck.c (syck_free_parser): fix memory leak by
+	  YAML::Syck.compile.
+
 Thu Jul 31 22:17:35 2008  Yusuke Endoh  <mame@t...>
 
 	* ext/bigdecimal/bigdecimal.c (VpMult): prevent memory leak.
Index: ext/syck/syck.c
===================================================================
--- ext/syck/syck.c	(revision 18296)
+++ ext/syck/syck.c	(revision 18297)
@@ -229,6 +229,22 @@
     }
 }
 
+typedef struct {
+   long hash;
+   char *buffer;
+   long length;
+   long remaining;
+   int  printed;
+} bytestring_t;
+
+int
+syck_st_free_syms( void *key, bytestring_t *sav, void *dummy )
+{
+    S_FREE(sav->buffer);
+    S_FREE(sav);
+    return ST_CONTINUE;
+}
+
 void
 syck_free_parser( SyckParser *p )
 {
@@ -237,6 +253,7 @@
      */
     if ( p->syms != NULL )
     {
+        st_foreach( p->syms, syck_st_free_syms, 0 );
         st_free_table( p->syms );
         p->syms = NULL;
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]