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

libavcodec/dvbsubdec.c:1311:1: start of procedure dvbsub_display_end_segment()
1309. }
1310. 
1311. static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
      ^
1312.                                         int buf_size, AVSubtitle *sub)
1313. {

libavcodec/dvbsubdec.c:1314:5: 
1312.                                         int buf_size, AVSubtitle *sub)
1313. {
1314.     DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
          ^
1315.     DVBSubDisplayDefinition *display_def = ctx->display_definition;
1316. 

libavcodec/dvbsubdec.c:1315:5: 
1313. {
1314.     DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
1315.     DVBSubDisplayDefinition *display_def = ctx->display_definition;
          ^
1316. 
1317.     DVBSubRegion *region;

libavcodec/dvbsubdec.c:1323:5: 
1321.     uint32_t *clut_table;
1322.     int i;
1323.     int offset_x=0, offset_y=0;
          ^
1324. 
1325.     sub->rects = NULL;

libavcodec/dvbsubdec.c:1325:5: 
1323.     int offset_x=0, offset_y=0;
1324. 
1325.     sub->rects = NULL;
          ^
1326.     sub->start_display_time = 0;
1327.     sub->end_display_time = ctx->time_out * 1000;

libavcodec/dvbsubdec.c:1326:5: 
1324. 
1325.     sub->rects = NULL;
1326.     sub->start_display_time = 0;
          ^
1327.     sub->end_display_time = ctx->time_out * 1000;
1328.     sub->format = 0;

libavcodec/dvbsubdec.c:1327:5: 
1325.     sub->rects = NULL;
1326.     sub->start_display_time = 0;
1327.     sub->end_display_time = ctx->time_out * 1000;
          ^
1328.     sub->format = 0;
1329. 

libavcodec/dvbsubdec.c:1328:5: 
1326.     sub->start_display_time = 0;
1327.     sub->end_display_time = ctx->time_out * 1000;
1328.     sub->format = 0;
          ^
1329. 
1330.     if (display_def) {

libavcodec/dvbsubdec.c:1330:9: Taking true branch
1328.     sub->format = 0;
1329. 
1330.     if (display_def) {
              ^
1331.         offset_x = display_def->x;
1332.         offset_y = display_def->y;

libavcodec/dvbsubdec.c:1331:9: 
1329. 
1330.     if (display_def) {
1331.         offset_x = display_def->x;
              ^
1332.         offset_y = display_def->y;
1333.     }

libavcodec/dvbsubdec.c:1332:9: 
1330.     if (display_def) {
1331.         offset_x = display_def->x;
1332.         offset_y = display_def->y;
              ^
1333.     }
1334. 

libavcodec/dvbsubdec.c:1335:5: 
1333.     }
1334. 
1335.     sub->num_rects = ctx->display_list_size;
          ^
1336. 
1337.     if (sub->num_rects > 0){

libavcodec/dvbsubdec.c:1337:9: Taking false branch
1335.     sub->num_rects = ctx->display_list_size;
1336. 
1337.     if (sub->num_rects > 0){
              ^
1338.         sub->rects = av_mallocz(sizeof(*sub->rects) * sub->num_rects);
1339.         for(i=0; i<sub->num_rects; i++)

libavcodec/dvbsubdec.c:1343:5: 
1341.     }
1342. 
1343.     i = 0;
          ^
1344. 
1345.     for (display = ctx->display_list; display; display = display->next) {

libavcodec/dvbsubdec.c:1345:10: 
1343.     i = 0;
1344. 
1345.     for (display = ctx->display_list; display; display = display->next) {
               ^
1346.         region = get_region(ctx, display->region_id);
1347.         rect = sub->rects[i];

libavcodec/dvbsubdec.c:1345:39: Loop condition is true. Entering loop body
1343.     i = 0;
1344. 
1345.     for (display = ctx->display_list; display; display = display->next) {
                                            ^
1346.         region = get_region(ctx, display->region_id);
1347.         rect = sub->rects[i];

libavcodec/dvbsubdec.c:1346:9: 
1344. 
1345.     for (display = ctx->display_list; display; display = display->next) {
1346.         region = get_region(ctx, display->region_id);
              ^
1347.         rect = sub->rects[i];
1348. 

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

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

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

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

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

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

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

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

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

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

libavcodec/dvbsubdec.c:275:5: 
  273.     }
  274. 
  275.     return ptr;
           ^
  276. }
  277. 

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

libavcodec/dvbsubdec.c:1347:9: 
1345.     for (display = ctx->display_list; display; display = display->next) {
1346.         region = get_region(ctx, display->region_id);
1347.         rect = sub->rects[i];
              ^
1348. 
1349.         if (!region)
