Bug 858900 - Poison JSContext. r=luke

This commit is contained in:
Benjamin Smedberg 2013-04-11 07:48:09 -04:00
parent 31cb07457a
commit 65bd5aa1b7
2 changed files with 12 additions and 1 deletions

View File

@ -508,6 +508,17 @@ js_delete(T *p)
}
}
template<class T>
static JS_ALWAYS_INLINE void
js_delete_poison(T *p)
{
if (p) {
p->~T();
memset(p, 0x3B, sizeof(T));
js_free(p);
}
}
template <class T>
static JS_ALWAYS_INLINE T *
js_pod_malloc()

View File

@ -431,7 +431,7 @@ js::DestroyContext(JSContext *cx, DestroyContextMode mode)
JS::PrepareForFullGC(rt);
GC(rt, GC_NORMAL, JS::gcreason::DESTROY_CONTEXT);
}
js_delete(cx);
js_delete_poison(cx);
}
bool