Skip to content

Instantly share code, notes, and snippets.

@directhex
Created December 4, 2015 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save directhex/01e853567fd2cc74ed39 to your computer and use it in GitHub Desktop.
Save directhex/01e853567fd2cc74ed39 to your computer and use it in GitHub Desktop.
diff --git a/mono/utils/strtod.c b/mono/utils/strtod.c
index 1ba4b72..ddbdd17 100644
--- a/mono/utils/strtod.c
+++ b/mono/utils/strtod.c
@@ -542,7 +542,7 @@ Balloc
#endif
ACQUIRE_DTOA_LOCK(0);
- if ((rv = freelist[k])) {
+ if (k <= Kmax && (rv = freelist[k])) {
freelist[k] = rv->next;
}
else {
@@ -579,10 +579,14 @@ Bfree
free (v);
#else
if (v) {
- ACQUIRE_DTOA_LOCK(0);
- v->next = freelist[v->k];
- freelist[v->k] = v;
- FREE_DTOA_LOCK(0);
+ if (v->k > Kmax)
+ free((void*)v);
+ else {
+ ACQUIRE_DTOA_LOCK(0);
+ v->next = freelist[v->k];
+ freelist[v->k] = v;
+ FREE_DTOA_LOCK(0);
+ }
}
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment