summaryrefslogtreecommitdiff
path: root/ext/syck/syck.h
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-20 04:13:26 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-20 04:13:26 +0000
commit534d30887d1fab63dadc0b392cda32d6f319e3b9 (patch)
tree0659845fb9f727b8322fc13672b4a33db5aa8983 /ext/syck/syck.h
parent3b7777959a81b8f16c991518e0daf770f882bf35 (diff)
* ext/syck/rubyext.c: fixed GC problem (backported HEAD 1.55 - 1.62)
[ruby-dev:27839] * ext/syck/syck.h (S_FREE): small hack. no need to check if pointer is NULL or not before S_FREE. * st.c: uses malloc instead of xmalloc to avoid GC. syck uses st_insert in gram.c to insert node from rb_syck_bad_anchor_handler into SyckParser's hash table. if GC occurs in st_insert, it's not under SyckParser's mark system yet. so RString can be released wrongly. [ruby-dev:28057] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/syck.h')
-rw-r--r--ext/syck/syck.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
index f7ac39fc94..c49f740173 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -51,7 +51,7 @@ extern "C" {
#define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
#define S_ALLOC(type) (type*)malloc(sizeof(type))
#define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
-#define S_FREE(n) free(n); n = NULL;
+#define S_FREE(n) if (n) { free(n); n = NULL; }
#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))