libavcodec/mpegaudiodec.c:2534: error: Null Dereference
  pointer `s->mp3decctx[0]` last assigned on line 2528 could be null and is dereferenced at line 2534, column 5.

libavcodec/mpegaudiodec.c:2497:1: start of procedure decode_init_mp3on4()
2495. 
2496. 
2497. static int decode_init_mp3on4(AVCodecContext * avctx)
      ^
2498. {
2499.     MP3On4DecodeContext *s = avctx->priv_data;

libavcodec/mpegaudiodec.c:2499:5: 
2497. static int decode_init_mp3on4(AVCodecContext * avctx)
2498. {
2499.     MP3On4DecodeContext *s = avctx->priv_data;
          ^
2500.     MPEG4AudioConfig cfg;
2501.     int i;

libavcodec/mpegaudiodec.c:2503:10: Taking false branch
2501.     int i;
2502. 
2503.     if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {
               ^
2504.         av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
2505.         return -1;

libavcodec/mpegaudiodec.c:2503:41: Taking false branch
2501.     int i;
2502. 
2503.     if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {
                                              ^
2504.         av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
2505.         return -1;

libavcodec/mpegaudiodec.c:2508:5: Skipping ff_mpeg4audio_get_config(): empty list of specs
2506.     }
2507. 
2508.     ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
          ^
2509.     if (!cfg.chan_config || cfg.chan_config > 7) {
2510.         av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");

libavcodec/mpegaudiodec.c:2509:10: Taking false branch
2507. 
2508.     ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
2509.     if (!cfg.chan_config || cfg.chan_config > 7) {
               ^
2510.         av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
2511.         return -1;

libavcodec/mpegaudiodec.c:2509:29: Taking false branch
2507. 
2508.     ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
2509.     if (!cfg.chan_config || cfg.chan_config > 7) {
                                  ^
2510.         av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
2511.         return -1;

libavcodec/mpegaudiodec.c:2513:5: 
2511.         return -1;
2512.     }
2513.     s->frames = mp3Frames[cfg.chan_config];
          ^
2514.     s->coff = chan_offset[cfg.chan_config];
2515.     avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];

libavcodec/mpegaudiodec.c:2514:5: 
2512.     }
2513.     s->frames = mp3Frames[cfg.chan_config];
2514.     s->coff = chan_offset[cfg.chan_config];
          ^
2515.     avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];
2516. 

libavcodec/mpegaudiodec.c:2515:5: 
2513.     s->frames = mp3Frames[cfg.chan_config];
2514.     s->coff = chan_offset[cfg.chan_config];
2515.     avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];
          ^
2516. 
2517.     if (cfg.sample_rate < 16000)

libavcodec/mpegaudiodec.c:2517:9: Taking true branch
2515.     avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];
2516. 
2517.     if (cfg.sample_rate < 16000)
              ^
2518.         s->syncword = 0xffe00000;
2519.     else

libavcodec/mpegaudiodec.c:2518:9: 
2516. 
2517.     if (cfg.sample_rate < 16000)
2518.         s->syncword = 0xffe00000;
              ^
2519.     else
2520.         s->syncword = 0xfff00000;

libavcodec/mpegaudiodec.c:2528:5: 
2526.      */
2527.     // Allocate zeroed memory for the first decoder context
2528.     s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));
          ^
2529.     // Put decoder context in place to make init_decode() happy
2530.     avctx->priv_data = s->mp3decctx[0];

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/mpegaudiodec.c:2530:5: 
2528.     s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));
2529.     // Put decoder context in place to make init_decode() happy
2530.     avctx->priv_data = s->mp3decctx[0];
          ^
2531.     decode_init(avctx);
2532.     // Restore mp3on4 context pointer

libavcodec/mpegaudiodec.c:2531:5: Skipping decode_init(): empty list of specs
2529.     // Put decoder context in place to make init_decode() happy
2530.     avctx->priv_data = s->mp3decctx[0];
2531.     decode_init(avctx);
          ^
2532.     // Restore mp3on4 context pointer
2533.     avctx->priv_data = s;

libavcodec/mpegaudiodec.c:2533:5: 
2531.     decode_init(avctx);
2532.     // Restore mp3on4 context pointer
2533.     avctx->priv_data = s;
          ^
2534.     s->mp3decctx[0]->adu_mode = 1; // Set adu mode
2535. 

libavcodec/mpegaudiodec.c:2534:5: 
2532.     // Restore mp3on4 context pointer
2533.     avctx->priv_data = s;
2534.     s->mp3decctx[0]->adu_mode = 1; // Set adu mode
          ^
2535. 
2536.     /* Create a separate codec/context for each frame (first is already ok).

static int decode_init_mp3on4(AVCodecContext * avctx)
{
    MP3On4DecodeContext *s = avctx->priv_data;
    MPEG4AudioConfig cfg;
    int i;
    if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {
        av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
        return -1;
    }
    ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
    if (!cfg.chan_config || cfg.chan_config > 7) {
        av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
        return -1;
    }
    s->frames = mp3Frames[cfg.chan_config];
    s->coff = chan_offset[cfg.chan_config];
    avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];
    if (cfg.sample_rate < 16000)
        s->syncword = 0xffe00000;
    else
        s->syncword = 0xfff00000;
    s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));
    avctx->priv_data = s->mp3decctx[0];
    decode_init(avctx);
    avctx->priv_data = s;
    s->mp3decctx[0]->adu_mode = 1;
    for (i = 1; i < s->frames; i++) {
        s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext));
        s->mp3decctx[i]->compute_antialias = s->mp3decctx[0]->compute_antialias;
        s->mp3decctx[i]->adu_mode = 1;
        s->mp3decctx[i]->avctx = avctx;
    }
    return 0;
}
['static int decode_init_mp3on4(AVCodecContext * avctx)\n{\n    MP3On4DecodeContext *s = avctx->priv_data;\n    MPEG4AudioConfig cfg;\n    int i;\n    if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {\n        av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\\n");\n        return -1;\n    }\n    ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);\n    if (!cfg.chan_config || cfg.chan_config > 7) {\n        av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\\n");\n        return -1;\n    }\n    s->frames = mp3Frames[cfg.chan_config];\n    s->coff = chan_offset[cfg.chan_config];\n    avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];\n    if (cfg.sample_rate < 16000)\n        s->syncword = 0xffe00000;\n    else\n        s->syncword = 0xfff00000;\n    s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));\n    avctx->priv_data = s->mp3decctx[0];\n    decode_init(avctx);\n    avctx->priv_data = s;\n    s->mp3decctx[0]->adu_mode = 1;\n    for (i = 1; i < s->frames; i++) {\n        s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext));\n        s->mp3decctx[i]->compute_antialias = s->mp3decctx[0]->compute_antialias;\n        s->mp3decctx[i]->adu_mode = 1;\n        s->mp3decctx[i]->avctx = avctx;\n    }\n    return 0;\n}', 'void *av_mallocz(unsigned int size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']