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

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

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

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

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

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

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

libavcodec/sonic.c:530:9: 
528.     else
529.     {
530.         s->num_taps = 128;
             ^
531.         s->downsampling = 2;
532.         s->quantization = 1.0;

libavcodec/sonic.c:531:9: 
529.     {
530.         s->num_taps = 128;
531.         s->downsampling = 2;
             ^
532.         s->quantization = 1.0;
533.     }

libavcodec/sonic.c:532:9: 
530.         s->num_taps = 128;
531.         s->downsampling = 2;
532.         s->quantization = 1.0;
             ^
533.     }
534. 

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

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

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

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

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

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