From: Jaroslav Kysela Date: Thu, 19 Nov 2015 17:42:14 +0000 (+0100) Subject: IPTV: add NULL ptr check to iptv_http_complete callback X-Git-Tag: v4.2.1~1506 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42fafd0075a4281ae60ee0c2fa5db012fe9246b8;p=thirdparty%2Ftvheadend.git IPTV: add NULL ptr check to iptv_http_complete callback --- diff --git a/src/input/mpegts/iptv/iptv_http.c b/src/input/mpegts/iptv/iptv_http.c index 0a14227c5..466196b5c 100644 --- a/src/input/mpegts/iptv/iptv_http.c +++ b/src/input/mpegts/iptv/iptv_http.c @@ -258,6 +258,8 @@ iptv_http_complete url_t u; int r; + if (hp == NULL || hp->im == NULL) + return 0; if (hp->m3u_header) { hp->m3u_header = 0; @@ -352,17 +354,18 @@ iptv_http_start hc->hc_data_complete = iptv_http_complete; hc->hc_handle_location = 1; /* allow redirects */ hc->hc_io_size = 128*1024; /* increase buffering */ + hp->hc = hc; + im->im_data = hp; + sbuf_init(&hp->m3u_sbuf); + sbuf_init_fixed(&im->mm_iptv_buffer, IPTV_BUF_SIZE); http_client_register(hc); /* register to the HTTP thread */ r = http_client_simple(hc, u); if (r < 0) { http_client_close(hc); + im->im_data = NULL; free(hp); return SM_CODE_TUNING_FAILED; } - hp->hc = hc; - im->im_data = hp; - sbuf_init(&hp->m3u_sbuf); - sbuf_init_fixed(&im->mm_iptv_buffer, IPTV_BUF_SIZE); return 0; }