From dd84e5742cb2fc6aaa96aa0214e0ed3a963d68da Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 3 Aug 2010 17:11:31 -0700 Subject: avoid munmap(MAP_FAILED,...) in GC phase This is only possible during an exit if our invocation of rb_gc() fails and causes the process to terminate. Otherwise the GC won't free something that's obviously on the stack. --- ext/raindrops/raindrops.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/raindrops/raindrops.c') diff --git a/ext/raindrops/raindrops.c b/ext/raindrops/raindrops.c index 65e3947..eb4694e 100644 --- a/ext/raindrops/raindrops.c +++ b/ext/raindrops/raindrops.c @@ -75,6 +75,7 @@ retry: r->drops = mmap(NULL, sizeof(struct raindrop) * r->size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); if (r->drops == MAP_FAILED) { + r->drops = NULL; if ((errno == EAGAIN || errno == ENOMEM) && tries-- > 0) { rb_gc(); goto retry; -- cgit v1.2.3-24-ge0c7