Skip to content

Commit

Permalink
Fix bug: Failed to resolve variables in the nginx.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
im-pingo committed May 23, 2020
1 parent dfbcc08 commit ac2df0f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/nginx-rtmp-module/ngx_rtmp_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,11 @@ ngx_rtmp_init_session(ngx_rtmp_session_t *s, ngx_connection_t *c)

ngx_rtmp_set_chunk_size(s, NGX_RTMP_DEFAULT_CHUNK_SIZE);

s->variables = ngx_pcalloc(s->pool, cmcf->variables.nelts
* sizeof(ngx_http_variable_value_t));
if (s->variables == NULL) {
s->variables = ngx_pcalloc(s->pool, cmcf->variables.nelts
* sizeof(ngx_http_variable_value_t));
}

if (s->variables == NULL) {
ngx_rtmp_finalize_session(s);
return;
Expand All @@ -496,6 +499,7 @@ ngx_rtmp_create_relay_session(ngx_rtmp_session_t *s, void *tag)
{
ngx_rtmp_session_t *rs;
ngx_live_relay_ctx_t *rctx;
ngx_rtmp_core_main_conf_t *cmcf;

rs = ngx_rtmp_create_session(s->addr_conf);
if (rs == NULL) {
Expand Down Expand Up @@ -554,6 +558,12 @@ ngx_rtmp_create_relay_session(ngx_rtmp_session_t *s, void *tag)

ngx_rtmp_set_ctx(rs, rctx, ngx_live_relay_module);

cmcf = ngx_rtmp_get_module_main_conf(rs, ngx_rtmp_core_module);
if (rs->variables == NULL) {
rs->variables = ngx_pcalloc(rs->pool, cmcf->variables.nelts
* sizeof(ngx_http_variable_value_t));
}

return rs;

destroy:
Expand Down

0 comments on commit ac2df0f

Please sign in to comment.