libavcodec/wmaenc.c:53: error: Null Dereference
  pointer `extradata` last assigned on line 51 could be null and is dereferenced at line 53, column 9.

libavcodec/wmaenc.c:29:1: start of procedure encode_init()
27. 
28. 
29. static int encode_init(AVCodecContext * avctx){
    ^
30.     WMACodecContext *s = avctx->priv_data;
31.     int i, flags1, flags2;

libavcodec/wmaenc.c:30:5: 
28. 
29. static int encode_init(AVCodecContext * avctx){
30.     WMACodecContext *s = avctx->priv_data;
        ^
31.     int i, flags1, flags2;
32.     uint8_t *extradata;

libavcodec/wmaenc.c:34:5: 
32.     uint8_t *extradata;
33. 
34.     s->avctx = avctx;
        ^
35. 
36.     if(avctx->channels > MAX_CHANNELS)

libavcodec/wmaenc.c:36:8: Taking false branch
34.     s->avctx = avctx;
35. 
36.     if(avctx->channels > MAX_CHANNELS)
           ^
37.         return -1;
38. 

libavcodec/wmaenc.c:39:8: Taking false branch
37.         return -1;
38. 
39.     if(avctx->bit_rate < 24*1000)
           ^
40.         return -1;
41. 

libavcodec/wmaenc.c:43:5: 
41. 
42.     /* extract flag infos */
43.     flags1 = 0;
        ^
44.     flags2 = 1;
45.     if (avctx->codec->id == CODEC_ID_WMAV1) {

libavcodec/wmaenc.c:44:5: 
42.     /* extract flag infos */
43.     flags1 = 0;
44.     flags2 = 1;
        ^
45.     if (avctx->codec->id == CODEC_ID_WMAV1) {
46.         extradata= av_malloc(4);

libavcodec/wmaenc.c:45:9: Taking false branch
43.     flags1 = 0;
44.     flags2 = 1;
45.     if (avctx->codec->id == CODEC_ID_WMAV1) {
            ^
46.         extradata= av_malloc(4);
47.         avctx->extradata_size= 4;

libavcodec/wmaenc.c:50:16: Taking true branch
48.         AV_WL16(extradata, flags1);
49.         AV_WL16(extradata+2, flags2);
50.     } else if (avctx->codec->id == CODEC_ID_WMAV2) {
                   ^
51.         extradata= av_mallocz(10);
52.         avctx->extradata_size= 10;

libavcodec/wmaenc.c:51:9: 
49.         AV_WL16(extradata+2, flags2);
50.     } else if (avctx->codec->id == CODEC_ID_WMAV2) {
51.         extradata= av_mallocz(10);
            ^
52.         avctx->extradata_size= 10;
53.         AV_WL32(extradata, flags1);

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/wmaenc.c:52:9: 
50.     } else if (avctx->codec->id == CODEC_ID_WMAV2) {
51.         extradata= av_mallocz(10);
52.         avctx->extradata_size= 10;
            ^
53.         AV_WL32(extradata, flags1);
54.         AV_WL16(extradata+4, flags2);

libavcodec/wmaenc.c:53:9: 
51.         extradata= av_mallocz(10);
52.         avctx->extradata_size= 10;
53.         AV_WL32(extradata, flags1);
            ^
54.         AV_WL16(extradata+4, flags2);
55.     }else

static int encode_init(AVCodecContext * avctx){
    WMACodecContext *s = avctx->priv_data;
    int i, flags1, flags2;
    uint8_t *extradata;
    s->avctx = avctx;
    if(avctx->channels > MAX_CHANNELS)
        return -1;
    if(avctx->bit_rate < 24*1000)
        return -1;
    flags1 = 0;
    flags2 = 1;
    if (avctx->codec->id == CODEC_ID_WMAV1) {
        extradata= av_malloc(4);
        avctx->extradata_size= 4;
        AV_WL16(extradata, flags1);
        AV_WL16(extradata+2, flags2);
    } else if (avctx->codec->id == CODEC_ID_WMAV2) {
        extradata= av_mallocz(10);
        avctx->extradata_size= 10;
        AV_WL32(extradata, flags1);
        AV_WL16(extradata+4, flags2);
    }else
        assert(0);
    avctx->extradata= extradata;
    s->use_exp_vlc = flags2 & 0x0001;
    s->use_bit_reservoir = flags2 & 0x0002;
    s->use_variable_block_len = flags2 & 0x0004;
    ff_wma_init(avctx, flags2);
    for(i = 0; i < s->nb_block_sizes; i++)
        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0);
    avctx->block_align=
    s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8);
    avctx->frame_size= s->frame_len;
    return 0;
}
['static int encode_init(AVCodecContext * avctx){\n    WMACodecContext *s = avctx->priv_data;\n    int i, flags1, flags2;\n    uint8_t *extradata;\n    s->avctx = avctx;\n    if(avctx->channels > MAX_CHANNELS)\n        return -1;\n    if(avctx->bit_rate < 24*1000)\n        return -1;\n    flags1 = 0;\n    flags2 = 1;\n    if (avctx->codec->id == CODEC_ID_WMAV1) {\n        extradata= av_malloc(4);\n        avctx->extradata_size= 4;\n        AV_WL16(extradata, flags1);\n        AV_WL16(extradata+2, flags2);\n    } else if (avctx->codec->id == CODEC_ID_WMAV2) {\n        extradata= av_mallocz(10);\n        avctx->extradata_size= 10;\n        AV_WL32(extradata, flags1);\n        AV_WL16(extradata+4, flags2);\n    }else\n        assert(0);\n    avctx->extradata= extradata;\n    s->use_exp_vlc = flags2 & 0x0001;\n    s->use_bit_reservoir = flags2 & 0x0002;\n    s->use_variable_block_len = flags2 & 0x0004;\n    ff_wma_init(avctx, flags2);\n    for(i = 0; i < s->nb_block_sizes; i++)\n        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0);\n    avctx->block_align=\n    s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8);\n    avctx->frame_size= s->frame_len;\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}']