Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
added guard conditionals around code that uses dconf to avoid SEGV.
Browse files Browse the repository at this point in the history
Thanks, Michael Granger.
  • Loading branch information
shugo committed May 27, 2006
1 parent 552ef72 commit cb645e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mod_ruby.c
Expand Up @@ -1177,7 +1177,7 @@ static void per_request_cleanup(request_rec *r, int flush)
restore_env(r->pool, rconf->saved_env);
}
rb_progname = Qnil;
if (dconf->gc_per_request)
if (dconf && dconf->gc_per_request)
rb_gc();
}

Expand Down
18 changes: 10 additions & 8 deletions request.c
Expand Up @@ -192,14 +192,16 @@ static VALUE apache_request_new(request_rec *r)
data->cookies = rb_hash_new();
data->param_table = Qnil;
data->options = rb_hash_new();
opts_arr = apr_table_elts(dconf->options);
opts = (table_entry *) opts_arr->elts;
for (i = 0; i < opts_arr->nelts; i++) {
if (opts[i].key == NULL)
continue;
rb_hash_aset(data->options,
rb_tainted_str_new2(opts[i].key),
rb_tainted_str_new2(opts[i].val));
if (dconf) {
opts_arr = apr_table_elts(dconf->options);
opts = (table_entry *) opts_arr->elts;
for (i = 0; i < opts_arr->nelts; i++) {
if (opts[i].key == NULL)
continue;
rb_hash_aset(data->options,
rb_tainted_str_new2(opts[i].key),
rb_tainted_str_new2(opts[i].val));
}
}

rb_apache_register_object(obj);
Expand Down

0 comments on commit cb645e8

Please sign in to comment.