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

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

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

libavcodec/dvbsubdec.c:907:5: 
905.     DVBSubContext *ctx = avctx->priv_data;
906. 
907.     const uint8_t *buf_end = buf + buf_size;
         ^
908.     int i, clut_id;
909.     DVBSubCLUT *clut;

libavcodec/dvbsubdec.c:916:10: 
914.     av_dlog(avctx, "DVB clut packet:\n");
915. 
916.     for (i=0; i < buf_size; i++) {
              ^
917.         av_dlog(avctx, "%02x ", buf[i]);
918.         if (i % 16 == 15)

libavcodec/dvbsubdec.c:916:15: Loop condition is false. Leaving loop
914.     av_dlog(avctx, "DVB clut packet:\n");
915. 
916.     for (i=0; i < buf_size; i++) {
                   ^
917.         av_dlog(avctx, "%02x ", buf[i]);
918.         if (i % 16 == 15)

libavcodec/dvbsubdec.c:922:9: Taking false branch
920.     }
921. 
922.     if (i % 16)
             ^
923.         av_dlog(avctx, "\n");
924. 

libavcodec/dvbsubdec.c:925:5: 
923.         av_dlog(avctx, "\n");
924. 
925.     clut_id = *buf++;
         ^
926.     buf += 1;
927. 

libavcodec/dvbsubdec.c:926:5: 
924. 
925.     clut_id = *buf++;
926.     buf += 1;
         ^
927. 
928.     clut = get_clut(ctx, clut_id);

libavcodec/dvbsubdec.c:928:5: 
926.     buf += 1;
927. 
928.     clut = get_clut(ctx, clut_id);
         ^
929. 
930.     if (!clut) {

libavcodec/dvbsubdec.c:252:1: start of procedure get_clut()
  250. }
  251. 
  252. static DVBSubCLUT* get_clut(DVBSubContext *ctx, int clut_id)
       ^
  253. {
  254.     DVBSubCLUT *ptr = ctx->clut_list;

libavcodec/dvbsubdec.c:254:5: 
  252. static DVBSubCLUT* get_clut(DVBSubContext *ctx, int clut_id)
  253. {
  254.     DVBSubCLUT *ptr = ctx->clut_list;
           ^
  255. 
  256.     while (ptr && ptr->id != clut_id) {

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

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

libavcodec/dvbsubdec.c:257:9: 
  255. 
  256.     while (ptr && ptr->id != clut_id) {
  257.         ptr = ptr->next;
               ^
  258.     }
  259. 

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

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

libavcodec/dvbsubdec.c:257:9: 
  255. 
  256.     while (ptr && ptr->id != clut_id) {
  257.         ptr = ptr->next;
               ^
  258.     }
  259. 

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

libavcodec/dvbsubdec.c:260:5: 
  258.     }
  259. 
  260.     return ptr;
           ^
  261. }
  262. 

libavcodec/dvbsubdec.c:261:1: return from a call to get_clut
  259. 
  260.     return ptr;
  261. }
       ^
  262. 
  263. static DVBSubRegion* get_region(DVBSubContext *ctx, int region_id)

libavcodec/dvbsubdec.c:930:10: Taking true branch
928.     clut = get_clut(ctx, clut_id);
929. 
930.     if (!clut) {
              ^
931.         clut = av_malloc(sizeof(DVBSubCLUT));
932. 

libavcodec/dvbsubdec.c:931:9: 
929. 
930.     if (!clut) {
931.         clut = av_malloc(sizeof(DVBSubCLUT));
             ^
932. 
933.         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(size_t size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(size_t 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-32) )
             ^
  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,32,size))
              ^
  84.         ptr = NULL;
  85. #elif HAVE_MEMALIGN

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

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

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

libavcodec/dvbsubdec.c:933:9: 
931.         clut = av_malloc(sizeof(DVBSubCLUT));
932. 
933.         memcpy(clut, &default_clut, sizeof(DVBSubCLUT));
             ^
934. 
935.         clut->id = clut_id;
