Skip to content
This repository has been archived by the owner on Aug 18, 2018. It is now read-only.

Commit

Permalink
nulling out struct members to fix null pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Apr 19, 2008
1 parent 23aa72e commit f07f892
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ext/spidermonkey/context.c
Expand Up @@ -72,6 +72,9 @@ static void deallocate(OurContext* context)
assert(JS_RemoveRoot(context->js, &(context->gcthings)));
JS_HashTableDestroy(context->rbids);
JS_HashTableDestroy(context->jsids);

context->jsids = 0;
context->rbids = 0;

JS_DestroyContext(context->js);
JS_DestroyRuntime(context->runtime);
Expand Down
2 changes: 1 addition & 1 deletion ext/spidermonkey/ruby_land_proxy.c
Expand Up @@ -247,7 +247,7 @@ call_function_property(int argc, VALUE* argv, VALUE self)
static void finalize(RubyLandProxy* proxy)
{
// could get finalized after the context has been freed
if (proxy->context)
if (proxy->context && proxy->context->jsids)
{
// remove this proxy from the OID map
JS_HashTableRemove(proxy->context->jsids, (void *)proxy->value);
Expand Down

0 comments on commit f07f892

Please sign in to comment.