Skip to content

Commit

Permalink
FIX some memory errors by valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
pyama86 committed Nov 7, 2023
1 parent b3ca912 commit 7dc6536
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/http/ngx_http_mruby_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ static mrb_value ngx_mrb_redirect(mrb_state *mrb, mrb_value self)
r->headers_out.status = rc;
} else {
ngx_http_internal_redirect(r, &ns, &r->args);
ngx_http_finalize_request(r, NGX_DONE);
}

return self;
Expand Down
8 changes: 5 additions & 3 deletions src/http/ngx_http_mruby_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ static ngx_int_t ngx_http_mruby_shared_state_compile(ngx_conf_t *cf, ngx_mrb_sta
#ifdef NGX_MRUBY_IREP_DEBUG
code->ctx->dump_result = TRUE;
#endif

if (code->code_type == NGX_MRB_CODE_TYPE_FILE) {
if ((mrb_file = fopen((char *)code->code.file, "r")) == NULL) {
return NGX_ERROR;
Expand All @@ -1026,7 +1026,7 @@ static ngx_int_t ngx_http_mruby_shared_state_compile(ngx_conf_t *cf, ngx_mrb_sta

#ifdef NGX_MRUBY_IREP_DEBUG
/* mrb_codedump_all() is not declared in mruby headers. So just follows the mruby way. See mruby/src/load.c. */
void mrb_codedump_all(mrb_state*, struct RProc*);
void mrb_codedump_all(mrb_state *, struct RProc *);
mrb_codedump_all(state->mrb, code->proc);
#endif

Expand Down Expand Up @@ -2047,9 +2047,11 @@ static int ngx_http_mruby_ssl_cert_handler(ngx_ssl_conn_t *ssl_conn, void *data)
return 0;
}

host.len = 0;
host.data = NULL;
servername = SSL_get_servername(ssl_conn, TLSEXT_NAMETYPE_host_name);

if (servername == NULL) {
host.len = 0;
ngx_log_error(NGX_LOG_DEBUG, c->log, 0, MODULE_NAME " : mruby ssl handler: SSL server name NULL");
} else {
host.len = ngx_strlen(servername);
Expand Down

0 comments on commit 7dc6536

Please sign in to comment.