libavcodec/dvbsubdec.c:1337: error: Null Dereference
  pointer `sub->rects` last assigned on line 1315 could be null and is dereferenced at line 1337, column 16.

libavcodec/dvbsubdec.c:1301:1: start of procedure dvbsub_display_end_segment()
1299. }
1300. 
1301. static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
      ^
1302.                                         int buf_size, AVSubtitle *sub)
1303. {

libavcodec/dvbsubdec.c:1304:5: 
1302.                                         int buf_size, AVSubtitle *sub)
1303. {
1304.     DVBSubContext *ctx = avctx->priv_data;
          ^
1305.     DVBSubDisplayDefinition *display_def = ctx->display_definition;
1306. 

libavcodec/dvbsubdec.c:1305:5: 
1303. {
1304.     DVBSubContext *ctx = avctx->priv_data;
1305.     DVBSubDisplayDefinition *display_def = ctx->display_definition;
          ^
1306. 
1307.     DVBSubRegion *region;

libavcodec/dvbsubdec.c:1313:5: 
1311.     uint32_t *clut_table;
1312.     int i;
1313.     int offset_x=0, offset_y=0;
          ^
1314. 
1315.     sub->rects = NULL;

libavcodec/dvbsubdec.c:1315:5: 
1313.     int offset_x=0, offset_y=0;
1314. 
1315.     sub->rects = NULL;
          ^
1316.     sub->start_display_time = 0;
1317.     sub->end_display_time = ctx->time_out * 1000;

libavcodec/dvbsubdec.c:1316:5: 
1314. 
1315.     sub->rects = NULL;
1316.     sub->start_display_time = 0;
          ^
1317.     sub->end_display_time = ctx->time_out * 1000;
1318.     sub->format = 0;

libavcodec/dvbsubdec.c:1317:5: 
1315.     sub->rects = NULL;
1316.     sub->start_display_time = 0;
1317.     sub->end_display_time = ctx->time_out * 1000;
          ^
1318.     sub->format = 0;
1319. 

libavcodec/dvbsubdec.c:1318:5: 
1316.     sub->start_display_time = 0;
1317.     sub->end_display_time = ctx->time_out * 1000;
1318.     sub->format = 0;
          ^
1319. 
1320.     if (display_def) {

libavcodec/dvbsubdec.c:1320:9: Taking true branch
1318.     sub->format = 0;
1319. 
1320.     if (display_def) {
              ^
1321.         offset_x = display_def->x;
1322.         offset_y = display_def->y;

libavcodec/dvbsubdec.c:1321:9: 
1319. 
1320.     if (display_def) {
1321.         offset_x = display_def->x;
              ^
1322.         offset_y = display_def->y;
1323.     }

libavcodec/dvbsubdec.c:1322:9: 
1320.     if (display_def) {
1321.         offset_x = display_def->x;
1322.         offset_y = display_def->y;
              ^
1323.     }
1324. 

libavcodec/dvbsubdec.c:1325:5: 
1323.     }
1324. 
1325.     sub->num_rects = ctx->display_list_size;
          ^
1326. 
1327.     if (sub->num_rects > 0){

libavcodec/dvbsubdec.c:1327:9: Taking false branch
1325.     sub->num_rects = ctx->display_list_size;
1326. 
1327.     if (sub->num_rects > 0){
              ^
1328.         sub->rects = av_mallocz(sizeof(*sub->rects) * sub->num_rects);
1329.         for(i=0; i<sub->num_rects; i++)

libavcodec/dvbsubdec.c:1333:5: 
1331.     }
1332. 
1333.     i = 0;
          ^
1334. 
1335.     for (display = ctx->display_list; display; display = display->next) {

libavcodec/dvbsubdec.c:1335:10: 
1333.     i = 0;
1334. 
1335.     for (display = ctx->display_list; display; display = display->next) {
               ^
1336.         region = get_region(ctx, display->region_id);
1337.         rect = sub->rects[i];

libavcodec/dvbsubdec.c:1335:39: Loop condition is true. Entering loop body
1333.     i = 0;
1334. 
1335.     for (display = ctx->display_list; display; display = display->next) {
                                            ^
1336.         region = get_region(ctx, display->region_id);
1337.         rect = sub->rects[i];

libavcodec/dvbsubdec.c:1336:9: 
1334. 
1335.     for (display = ctx->display_list; display; display = display->next) {
1336.         region = get_region(ctx, display->region_id);
              ^
1337.         rect = sub->rects[i];
1338. 

libavcodec/dvbsubdec.c:264:1: start of procedure get_region()
  262. }
  263. 
  264. static DVBSubRegion* get_region(DVBSubContext *ctx, int region_id)
       ^
  265. {
  266.     DVBSubRegion *ptr = ctx->region_list;

libavcodec/dvbsubdec.c:266:5: 
  264. static DVBSubRegion* get_region(DVBSubContext *ctx, int region_id)
  265. {
  266.     DVBSubRegion *ptr = ctx->region_list;
           ^
  267. 
  268.     while (ptr && ptr->id != region_id) {

libavcodec/dvbsubdec.c:268:12: Loop condition is true. Entering loop body
  266.     DVBSubRegion *ptr = ctx->region_list;
  267. 
  268.     while (ptr && ptr->id != region_id) {
                  ^
  269.         ptr = ptr->next;
  270.     }

libavcodec/dvbsubdec.c:268:19: Loop condition is true. Entering loop body
  266.     DVBSubRegion *ptr = ctx->region_list;
  267. 
  268.     while (ptr && ptr->id != region_id) {
                         ^
  269.         ptr = ptr->next;
  270.     }

libavcodec/dvbsubdec.c:269:9: 
  267. 
  268.     while (ptr && ptr->id != region_id) {
  269.         ptr = ptr->next;
               ^
  270.     }
  271. 

libavcodec/dvbsubdec.c:268:12: Loop condition is true. Entering loop body
  266.     DVBSubRegion *ptr = ctx->region_list;
  267. 
  268.     while (ptr && ptr->id != region_id) {
                  ^
  269.         ptr = ptr->next;
  270.     }

libavcodec/dvbsubdec.c:268:19: Loop condition is true. Entering loop body
  266.     DVBSubRegion *ptr = ctx->region_list;
  267. 
  268.     while (ptr && ptr->id != region_id) {
                         ^
  269.         ptr = ptr->next;
  270.     }

libavcodec/dvbsubdec.c:269:9: 
  267. 
  268.     while (ptr && ptr->id != region_id) {
  269.         ptr = ptr->next;
               ^
  270.     }
  271. 

libavcodec/dvbsubdec.c:268:12: Loop condition is true. Entering loop body
  266.     DVBSubRegion *ptr = ctx->region_list;
  267. 
  268.     while (ptr && ptr->id != region_id) {
                  ^
  269.         ptr = ptr->next;
  270.     }

libavcodec/dvbsubdec.c:268:19: Loop condition is false. Leaving loop
  266.     DVBSubRegion *ptr = ctx->region_list;
  267. 
  268.     while (ptr && ptr->id != region_id) {
                         ^
  269.         ptr = ptr->next;
  270.     }

libavcodec/dvbsubdec.c:272:5: 
  270.     }
  271. 
  272.     return ptr;
           ^
  273. }
  274. 

libavcodec/dvbsubdec.c:273:1: return from a call to get_region
  271. 
  272.     return ptr;
  273. }
       ^
  274. 
  275. static void delete_region_display_list(DVBSubContext *ctx, DVBSubRegion *region)

libavcodec/dvbsubdec.c:1337:9: 
1335.     for (display = ctx->display_list; display; display = display->next) {
1336.         region = get_region(ctx, display->region_id);
1337.         rect = sub->rects[i];
              ^
1338. 
1339.         if (!region)
