libavcodec/sonic.c:545: error: Null Dereference
  pointer `s->tap_quant` last assigned on line 543 could be null and is dereferenced at line 545, column 9.

libavcodec/sonic.c:505:1: start of procedure sonic_encode_init()
503. }
504. 
505. static av_cold int sonic_encode_init(AVCodecContext *avctx)
     ^
506. {
507.     SonicContext *s = avctx->priv_data;

libavcodec/sonic.c:507:5: 
505. static av_cold int sonic_encode_init(AVCodecContext *avctx)
506. {
507.     SonicContext *s = avctx->priv_data;
         ^
508.     PutBitContext pb;
509.     int i, version = 0;

libavcodec/sonic.c:509:5: 
507.     SonicContext *s = avctx->priv_data;
508.     PutBitContext pb;
509.     int i, version = 0;
         ^
510. 
511.     if (avctx->channels > MAX_CHANNELS)

libavcodec/sonic.c:511:9: Taking false branch
509.     int i, version = 0;
510. 
511.     if (avctx->channels > MAX_CHANNELS)
             ^
512.     {
513.         av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");

libavcodec/sonic.c:517:9: Taking false branch
515.     }
516. 
517.     if (avctx->channels == 2)
             ^
518.         s->decorrelation = MID_SIDE;
519. 

libavcodec/sonic.c:520:9: Taking true branch
518.         s->decorrelation = MID_SIDE;
519. 
520.     if (avctx->codec->id == CODEC_ID_SONIC_LS)
             ^
521.     {
522.         s->lossless = 1;

libavcodec/sonic.c:522:9: 
520.     if (avctx->codec->id == CODEC_ID_SONIC_LS)
521.     {
522.         s->lossless = 1;
             ^
523.         s->num_taps = 32;
524.         s->downsampling = 1;

libavcodec/sonic.c:523:9: 
521.     {
522.         s->lossless = 1;
523.         s->num_taps = 32;
             ^
524.         s->downsampling = 1;
525.         s->quantization = 0.0;

libavcodec/sonic.c:524:9: 
522.         s->lossless = 1;
523.         s->num_taps = 32;
524.         s->downsampling = 1;
             ^
525.         s->quantization = 0.0;
526.     }

libavcodec/sonic.c:525:9: 
523.         s->num_taps = 32;
524.         s->downsampling = 1;
525.         s->quantization = 0.0;
             ^
526.     }
527.     else

libavcodec/sonic.c:535:10: Taking false branch
533. 
534.     // max tap 2048
535.     if ((s->num_taps < 32) || (s->num_taps > 1024) ||
              ^
536.         ((s->num_taps>>5)<<5 != s->num_taps))
537.     {

libavcodec/sonic.c:535:32: Taking false branch
533. 
534.     // max tap 2048
535.     if ((s->num_taps < 32) || (s->num_taps > 1024) ||
                                    ^
536.         ((s->num_taps>>5)<<5 != s->num_taps))
537.     {

libavcodec/sonic.c:536:10: Taking false branch
534.     // max tap 2048
535.     if ((s->num_taps < 32) || (s->num_taps > 1024) ||
536.         ((s->num_taps>>5)<<5 != s->num_taps))
              ^
537.     {
538.         av_log(avctx, AV_LOG_ERROR, "Invalid number of taps\n");

libavcodec/sonic.c:543:5: 
541. 
542.     // generate taps
543.     s->tap_quant = av_mallocz(4* s->num_taps);
         ^
544.     for (i = 0; i < s->num_taps; i++)
545.         s->tap_quant[i] = (int)(sqrt(i+1));

libavutil/mem.c:132:1: start of procedure av_mallocz()
  130. }
  131. 
  132. void *av_mallocz(unsigned int size)
       ^
  133. {
  134.     void *ptr = av_malloc(size);

libavutil/mem.c:134:5: 
  132. void *av_mallocz(unsigned int size)
  133. {
  134.     void *ptr = av_malloc(size);
           ^
  135.     if (ptr)
  136.         memset(ptr, 0, size);

libavutil/mem.c:42:1: start of procedure av_malloc()
    40.    linker will do it automatically */
    41. 
    42. void *av_malloc(unsigned int size)
        ^
    43. {
    44.     void *ptr;

libavutil/mem.c:50:8: Taking false branch
    48. 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
               ^
    51.         return NULL;
    52. 

libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
    59.     ((char*)ptr)[-1]= diff;
    60. #elif defined (HAVE_MEMALIGN)
    61.     ptr = memalign(16,size);
            ^
    62.     /* Why 64?
    63.        Indeed, we should align it:

libavutil/mem.c:91:5: 
    89.     ptr = malloc(size);
    90. #endif
    91.     return ptr;
            ^
    92. }
    93. 

libavutil/mem.c:92:1: return from a call to av_malloc
    90. #endif
    91.     return ptr;
    92. }
        ^
    93. 
    94. void *av_realloc(void *ptr, unsigned int size)

libavutil/mem.c:135:9: Taking false branch
  133. {
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
               ^
  136.         memset(ptr, 0, size);
  137.     return ptr;

libavutil/mem.c:137:5: 
  135.     if (ptr)
  136.         memset(ptr, 0, size);
  137.     return ptr;
           ^
  138. }
  139. 

libavutil/mem.c:138:1: return from a call to av_mallocz
  136.         memset(ptr, 0, size);
  137.     return ptr;
  138. }
       ^
  139. 
  140. char *av_strdup(const char *s)

libavcodec/sonic.c:544:10: 
542.     // generate taps
543.     s->tap_quant = av_mallocz(4* s->num_taps);
544.     for (i = 0; i < s->num_taps; i++)
              ^
545.         s->tap_quant[i] = (int)(sqrt(i+1));
546. 

libavcodec/sonic.c:544:17: Loop condition is true. Entering loop body
542.     // generate taps
543.     s->tap_quant = av_mallocz(4* s->num_taps);
544.     for (i = 0; i < s->num_taps; i++)
                     ^
545.         s->tap_quant[i] = (int)(sqrt(i+1));
546. 

libavcodec/sonic.c:545:9: 
543.     s->tap_quant = av_mallocz(4* s->num_taps);
544.     for (i = 0; i < s->num_taps; i++)
545.         s->tap_quant[i] = (int)(sqrt(i+1));
             ^
546. 
547.     s->channels = avctx->channels;
