mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-06-29 00:18:58 +02:00
fixed memleak in AMF sender
This commit is contained in:
parent
dbbd320864
commit
a43412edd1
|
@ -7,40 +7,43 @@
|
||||||
#include "ngx_rtmp_amf.h"
|
#include "ngx_rtmp_amf.h"
|
||||||
|
|
||||||
|
|
||||||
#define NGX_RTMP_USER_START(s, tp) \
|
#define NGX_RTMP_USER_START(s, tp) \
|
||||||
ngx_rtmp_header_t __h; \
|
ngx_rtmp_header_t __h; \
|
||||||
ngx_chain_t *__l; \
|
ngx_chain_t *__l; \
|
||||||
ngx_buf_t *__b; \
|
ngx_buf_t *__b; \
|
||||||
ngx_rtmp_core_srv_conf_t *__cscf; \
|
ngx_rtmp_core_srv_conf_t *__cscf; \
|
||||||
\
|
ngx_int_t rc; \
|
||||||
__cscf = ngx_rtmp_get_module_srv_conf( \
|
\
|
||||||
s, ngx_rtmp_core_module); \
|
__cscf = ngx_rtmp_get_module_srv_conf( \
|
||||||
memset(&__h, 0, sizeof(__h)); \
|
s, ngx_rtmp_core_module); \
|
||||||
__h.type = tp; \
|
memset(&__h, 0, sizeof(__h)); \
|
||||||
__h.csid = 2; \
|
__h.type = tp; \
|
||||||
__l = ngx_rtmp_alloc_shared_buf(__cscf); \
|
__h.csid = 2; \
|
||||||
if (__l == NULL) { \
|
__l = ngx_rtmp_alloc_shared_buf(__cscf); \
|
||||||
return NGX_ERROR; \
|
if (__l == NULL) { \
|
||||||
} \
|
return NGX_ERROR; \
|
||||||
|
} \
|
||||||
__b = __l->buf;
|
__b = __l->buf;
|
||||||
|
|
||||||
#define NGX_RTMP_UCTL_START(s, type, utype) \
|
#define NGX_RTMP_UCTL_START(s, type, utype) \
|
||||||
NGX_RTMP_USER_START(s, type); \
|
NGX_RTMP_USER_START(s, type); \
|
||||||
*(__b->last++) = (u_char)((utype) >> 8); \
|
*(__b->last++) = (u_char)((utype) >> 8); \
|
||||||
*(__b->last++) = (u_char)(utype);
|
*(__b->last++) = (u_char)(utype);
|
||||||
|
|
||||||
#define NGX_RTMP_USER_OUT1(v) \
|
#define NGX_RTMP_USER_OUT1(v) \
|
||||||
*(__b->last++) = ((u_char*)&v)[0];
|
*(__b->last++) = ((u_char*)&v)[0];
|
||||||
|
|
||||||
#define NGX_RTMP_USER_OUT4(v) \
|
#define NGX_RTMP_USER_OUT4(v) \
|
||||||
*(__b->last++) = ((u_char*)&v)[3]; \
|
*(__b->last++) = ((u_char*)&v)[3]; \
|
||||||
*(__b->last++) = ((u_char*)&v)[2]; \
|
*(__b->last++) = ((u_char*)&v)[2]; \
|
||||||
*(__b->last++) = ((u_char*)&v)[1]; \
|
*(__b->last++) = ((u_char*)&v)[1]; \
|
||||||
*(__b->last++) = ((u_char*)&v)[0];
|
*(__b->last++) = ((u_char*)&v)[0];
|
||||||
|
|
||||||
#define NGX_RTMP_USER_END(s) \
|
#define NGX_RTMP_USER_END(s) \
|
||||||
ngx_rtmp_prepare_message(s, &__h, NULL, __l); \
|
ngx_rtmp_prepare_message(s, &__h, NULL, __l); \
|
||||||
return ngx_rtmp_send_message(s, __l, 0); \
|
rc = ngx_rtmp_send_message(s, __l, 0); \
|
||||||
|
ngx_rtmp_free_shared_bufs(__cscf, __l); \
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
|
||||||
/* Protocol control messages */
|
/* Protocol control messages */
|
||||||
|
|
Loading…
Reference in a new issue