diff --git a/ChangeLog b/ChangeLog index 4b30b59370..e435b06b20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 30 21:08:06 2008 Yusuke Endoh + + * ext/syck/syck.c (syck_free_parser): fix memory leak by + YAML::Syck.compile. + Thu Jul 31 22:17:35 2008 Yusuke Endoh * ext/bigdecimal/bigdecimal.c (VpMult): prevent memory leak. diff --git a/ext/syck/syck.c b/ext/syck/syck.c index dbf753337e..92b7566d1a 100644 --- a/ext/syck/syck.c +++ b/ext/syck/syck.c @@ -229,6 +229,22 @@ syck_st_free( SyckParser *p ) } } +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 @@ syck_free_parser( SyckParser *p ) */ if ( p->syms != NULL ) { + st_foreach( p->syms, syck_st_free_syms, 0 ); st_free_table( p->syms ); p->syms = NULL; }