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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

libavcodec/dvbsubdec.c:932:9: 
930. 
931.     if (!clut) {
932.         clut = av_malloc(sizeof(DVBSubCLUT));
             ^
933. 
934.         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:9: Taking false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if (size > (INT_MAX-32) || !size)
              ^
  73.         return NULL;
  74. 

libavutil/mem.c:72:33: Taking false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if (size > (INT_MAX-32) || !size)
                                      ^
  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_ALIGNED_MALLOC

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

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, size_t size)

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