summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--vm_trace.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b3ede7e17b..d400692113 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon May 27 16:16:18 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use
+ ruby_xmalloc/xfree. It is safe during GC.
+
Mon May 27 09:24:03 2013 Koichi Sasada <ko1@atdot.net>
* test/-ext-/postponed_job/test_postponed_job.rb: fix typo and class name.
diff --git a/vm_trace.c b/vm_trace.c
index 9c77153c3e..75988060fd 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -1390,7 +1390,7 @@ rb_postponed_job_register(unsigned int flags, rb_postponed_job_func_t func, void
{
rb_thread_t *th = GET_THREAD();
rb_vm_t *vm = th->vm;
- rb_postponed_job_t *pjob = (rb_postponed_job_t *)malloc(sizeof(rb_postponed_job_t)); /* postponed_job should be separated with Ruby's GC */
+ rb_postponed_job_t *pjob = (rb_postponed_job_t *)ruby_xmalloc(sizeof(rb_postponed_job_t));
if (pjob == NULL) return 0; /* failed */
pjob->flags = flags;
@@ -1429,7 +1429,7 @@ rb_postponed_job_flush(rb_vm_t *vm)
while (pjob) {
next_pjob = pjob->next;
pjob->func(pjob->data);
- free(pjob); /* postponed_job should be separated with Ruby's GC */
+ ruby_xfree(pjob); /* postponed_job should be separated with Ruby's GC */
pjob = next_pjob;
}
}