mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-20 18:01:08 +02:00
fixed string allocation in relay module
This commit is contained in:
parent
ba58e69b90
commit
5999daebc2
|
@ -272,6 +272,8 @@ ngx_rtmp_relay_create_remote_ctx(ngx_rtmp_session_t *s, ngx_str_t* name,
|
||||||
ngx_str_t v, *uri;
|
ngx_str_t v, *uri;
|
||||||
u_char *first, *last, *p;
|
u_char *first, *last, *p;
|
||||||
|
|
||||||
|
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
|
"relay: create remote context");
|
||||||
|
|
||||||
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_relay_module);
|
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_relay_module);
|
||||||
|
|
||||||
|
@ -326,6 +328,10 @@ ngx_rtmp_relay_create_remote_ctx(ngx_rtmp_session_t *s, ngx_str_t* name,
|
||||||
|
|
||||||
/* deduce app */
|
/* deduce app */
|
||||||
p = ngx_strlchr(first, last, '/');
|
p = ngx_strlchr(first, last, '/');
|
||||||
|
if (p == NULL) {
|
||||||
|
p = last;
|
||||||
|
}
|
||||||
|
|
||||||
if (rctx->app.len == 0 && first != p) {
|
if (rctx->app.len == 0 && first != p) {
|
||||||
v.data = first;
|
v.data = first;
|
||||||
v.len = p - first;
|
v.len = p - first;
|
||||||
|
@ -335,7 +341,10 @@ ngx_rtmp_relay_create_remote_ctx(ngx_rtmp_session_t *s, ngx_str_t* name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deduce play_path */
|
/* deduce play_path */
|
||||||
++p;
|
if (p != last) {
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
|
||||||
if (rctx->play_path.len == 0 && p != last) {
|
if (rctx->play_path.len == 0 && p != last) {
|
||||||
v.data = p;
|
v.data = p;
|
||||||
v.len = last - p;
|
v.len = last - p;
|
||||||
|
@ -418,6 +427,9 @@ ngx_rtmp_relay_create_local_ctx(ngx_rtmp_session_t *s, ngx_str_t *name,
|
||||||
{
|
{
|
||||||
ngx_rtmp_relay_ctx_t *ctx;
|
ngx_rtmp_relay_ctx_t *ctx;
|
||||||
|
|
||||||
|
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
|
"relay: create local context");
|
||||||
|
|
||||||
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_relay_module);
|
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_relay_module);
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_rtmp_relay_ctx_t));
|
ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_rtmp_relay_ctx_t));
|
||||||
|
|
Loading…
Reference in a new issue