From eaef3b90b9d926e5634a96412139d19e9a311d16 Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Wed, 14 Mar 2012 10:22:27 +0400 Subject: [PATCH] fixed buffer allocation when broadcasting --- TODO | 2 ++ ngx_rtmp_broadcast_module.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index fceef65..8e58a66 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,8 @@ - closing session on send error causes crash because of double-freeing stack +- add max message size + - recognize amf-meta - shortcuts for big-endian copy diff --git a/ngx_rtmp_broadcast_module.c b/ngx_rtmp_broadcast_module.c index 6838798..0f1a63d 100644 --- a/ngx_rtmp_broadcast_module.c +++ b/ngx_rtmp_broadcast_module.c @@ -227,7 +227,7 @@ ngx_rtmp_broadcast_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, ngx_rtmp_broadcast_ctx_t *ctx, *cctx; ngx_chain_t *out, *l, **ll; u_char *p; - size_t nsubs; + size_t nsubs, size; c = s->connection; @@ -267,9 +267,9 @@ ngx_rtmp_broadcast_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, p = in->buf->pos; } - l->buf->last = ngx_cpymem(l->buf->last, p, - l->buf->end - l->buf->last); - p += (l->buf->end - l->buf->last); + size = l->buf->end - l->buf->last; + l->buf->last = ngx_cpymem(l->buf->last, p, size); + p += size; } done: