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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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