Skip to content

Commit 1d8e972

Browse files
committed
fix crash: null pointer
1 parent a0ac7be commit 1d8e972

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

modules/nginx-rtmp-module/mpegts/ngx_hls_live_module.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ ngx_hls_live_write_playlist(ngx_rtmp_session_t *s, ngx_buf_t *out,
246246
ngx_hls_live_app_conf_t *hacf;
247247

248248
ctx = ngx_rtmp_get_module_ctx(s, ngx_hls_live_module);
249+
if (ctx == NULL) {
250+
ngx_log_error(NGX_LOG_ERR, s->log, 0, "hls-live: playlist| ctx is null");
251+
252+
return NGX_ERROR;
253+
}
249254

250255
ctx->last_time = time(NULL);
251256

@@ -788,6 +793,10 @@ ngx_hls_live_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
788793
ngx_del_timer(&ctx->ev);
789794
}
790795

796+
if (ctx->stream == NULL) {
797+
goto next;
798+
}
799+
791800
ngx_rtmp_fire_event(s, NGX_MPEGTS_MSG_CLOSE, NULL, NULL);
792801

793802
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->log, 0,

modules/nginx-rtmp-module/ngx_rtmp_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ ngx_rtmp_finalize_session(ngx_rtmp_session_t *s)
392392

393393
if (s->live_type == NGX_HLS_LIVE) {
394394
ngx_rtmp_finalize_fake_session(s);
395+
return;
395396
}
396397

397398
if (s->destroyed) {

0 commit comments

Comments
 (0)