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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

libavcodec/dvbsubdec.c:270:5: 
  268.     }
  269. 
  270.     return ptr;
           ^
  271. }
  272. 

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

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