libavcodec/dvbsubdec.c:941: error: Null Dereference
  pointer `clut` last assigned on line 939 could be null and is dereferenced by call to `memcpy()` at line 941, column 9.

libavcodec/dvbsubdec.c:905:1: start of procedure dvbsub_parse_clut_segment()
903. }
904. 
905. static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
     ^
906.                                         const uint8_t *buf, int buf_size)
907. {

libavcodec/dvbsubdec.c:908:5: 
906.                                         const uint8_t *buf, int buf_size)
907. {
908.     DVBSubContext *ctx = avctx->priv_data;
         ^
909. 
910.     const uint8_t *buf_end = buf + buf_size;

libavcodec/dvbsubdec.c:910:5: 
908.     DVBSubContext *ctx = avctx->priv_data;
909. 
910.     const uint8_t *buf_end = buf + buf_size;
         ^
911.     int clut_id;
912.     DVBSubCLUT *clut;

libavcodec/dvbsubdec.c:933:5: 
931. #endif
932. 
933.     clut_id = *buf++;
         ^
934.     buf += 1;
935. 

libavcodec/dvbsubdec.c:934:5: 
932. 
933.     clut_id = *buf++;
934.     buf += 1;
         ^
935. 
936.     clut = get_clut(ctx, clut_id);

libavcodec/dvbsubdec.c:936:5: 
934.     buf += 1;
935. 
936.     clut = get_clut(ctx, clut_id);
         ^
937. 
938.     if (!clut) {

libavcodec/dvbsubdec.c:256:1: start of procedure get_clut()
  254. }
  255. 
  256. static DVBSubCLUT* get_clut(DVBSubContext *ctx, int clut_id)
       ^
  257. {
  258.     DVBSubCLUT *ptr = ctx->clut_list;

libavcodec/dvbsubdec.c:258:5: 
  256. static DVBSubCLUT* get_clut(DVBSubContext *ctx, int clut_id)
  257. {
  258.     DVBSubCLUT *ptr = ctx->clut_list;
           ^
  259. 
  260.     while (ptr && ptr->id != clut_id) {

libavcodec/dvbsubdec.c:260:12: Loop condition is true. Entering loop body
  258.     DVBSubCLUT *ptr = ctx->clut_list;
  259. 
  260.     while (ptr && ptr->id != clut_id) {
                  ^
  261.         ptr = ptr->next;
  262.     }

libavcodec/dvbsubdec.c:260:19: Loop condition is true. Entering loop body
  258.     DVBSubCLUT *ptr = ctx->clut_list;
  259. 
  260.     while (ptr && ptr->id != clut_id) {
                         ^
  261.         ptr = ptr->next;
  262.     }

libavcodec/dvbsubdec.c:261:9: 
  259. 
  260.     while (ptr && ptr->id != clut_id) {
  261.         ptr = ptr->next;
               ^
  262.     }
  263. 

libavcodec/dvbsubdec.c:260:12: Loop condition is true. Entering loop body
  258.     DVBSubCLUT *ptr = ctx->clut_list;
  259. 
  260.     while (ptr && ptr->id != clut_id) {
                  ^
  261.         ptr = ptr->next;
  262.     }

libavcodec/dvbsubdec.c:260:19: Loop condition is true. Entering loop body
  258.     DVBSubCLUT *ptr = ctx->clut_list;
  259. 
  260.     while (ptr && ptr->id != clut_id) {
                         ^
  261.         ptr = ptr->next;
  262.     }

libavcodec/dvbsubdec.c:261:9: 
  259. 
  260.     while (ptr && ptr->id != clut_id) {
  261.         ptr = ptr->next;
               ^
  262.     }
  263. 

libavcodec/dvbsubdec.c:260:12: Loop condition is false. Leaving loop
  258.     DVBSubCLUT *ptr = ctx->clut_list;
  259. 
  260.     while (ptr && ptr->id != clut_id) {
                  ^
  261.         ptr = ptr->next;
  262.     }

libavcodec/dvbsubdec.c:264:5: 
  262.     }
  263. 
  264.     return ptr;
           ^
  265. }
  266. 

libavcodec/dvbsubdec.c:265:1: return from a call to get_clut
  263. 
  264.     return ptr;
  265. }
       ^
  266. 
  267. static DVBSubRegion* get_region(DVBSubContext *ctx, int region_id)

libavcodec/dvbsubdec.c:938:10: Taking true branch
936.     clut = get_clut(ctx, clut_id);
937. 
938.     if (!clut) {
              ^
939.         clut = av_malloc(sizeof(DVBSubCLUT));
940. 

libavcodec/dvbsubdec.c:939:9: 
937. 
938.     if (!clut) {
939.         clut = av_malloc(sizeof(DVBSubCLUT));
             ^
940. 
941.         memcpy(clut, &default_clut, sizeof(DVBSubCLUT));

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(unsigned int size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(unsigned int size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:83:9: Taking true branch
  81.     ((char*)ptr)[-1]= diff;
  82. #elif HAVE_POSIX_MEMALIGN
  83.     if (posix_memalign(&ptr,16,size))
              ^
  84.         ptr = NULL;
  85. #elif HAVE_MEMALIGN

libavutil/mem.c:84:9: 
  82. #elif HAVE_POSIX_MEMALIGN
  83.     if (posix_memalign(&ptr,16,size))
  84.         ptr = NULL;
              ^
  85. #elif HAVE_MEMALIGN
  86.     ptr = memalign(16,size);

libavutil/mem.c:116:5: 
  114.     ptr = malloc(size);
  115. #endif
  116.     return ptr;
           ^
  117. }
  118. 

libavutil/mem.c:117:1: return from a call to av_malloc
  115. #endif
  116.     return ptr;
  117. }
       ^
  118. 
  119. void *av_realloc(void *ptr, unsigned int size)

libavcodec/dvbsubdec.c:941:9: 
939.         clut = av_malloc(sizeof(DVBSubCLUT));
940. 
941.         memcpy(clut, &default_clut, sizeof(DVBSubCLUT));
             ^
942. 
943.         clut->id = clut_id;
