libavcodec/pcm.c:124: error: Null Dereference
  pointer `avctx->coded_frame` last assigned on line 123 could be null and is dereferenced at line 124, column 5.

libavcodec/pcm.c:107:1: start of procedure pcm_encode_init()
105. }
106. 
107. static av_cold int pcm_encode_init(AVCodecContext *avctx)
     ^
108. {
109.     avctx->frame_size = 1;

libavcodec/pcm.c:109:5: 
107. static av_cold int pcm_encode_init(AVCodecContext *avctx)
108. {
109.     avctx->frame_size = 1;
         ^
110.     switch(avctx->codec->id) {
111.     case CODEC_ID_PCM_ALAW:

libavcodec/pcm.c:110:5: 
108. {
109.     avctx->frame_size = 1;
110.     switch(avctx->codec->id) {
         ^
111.     case CODEC_ID_PCM_ALAW:
112.         build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);

libavcodec/pcm.c:111:5: Switch condition is false. Skipping switch case
109.     avctx->frame_size = 1;
110.     switch(avctx->codec->id) {
111.     case CODEC_ID_PCM_ALAW:
         ^
112.         build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
113.         break;

libavcodec/pcm.c:114:5: Switch condition is false. Skipping switch case
112.         build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
113.         break;
114.     case CODEC_ID_PCM_MULAW:
         ^
115.         build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);
116.         break;

libavcodec/pcm.c:121:5: 
119.     }
120. 
121.     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
         ^
122.     avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
123.     avctx->coded_frame= avcodec_alloc_frame();

libavcodec/utils.c:958:1: start of procedure av_get_bits_per_sample()
  956. }
  957. 
  958. int av_get_bits_per_sample(enum CodecID codec_id){
       ^
  959.     switch(codec_id){
  960.     case CODEC_ID_ADPCM_SBPRO_2:

libavcodec/utils.c:959:5: 
  957. 
  958. int av_get_bits_per_sample(enum CodecID codec_id){
  959.     switch(codec_id){
           ^
  960.     case CODEC_ID_ADPCM_SBPRO_2:
  961.         return 2;

libavcodec/utils.c:960:5: Switch condition is false. Skipping switch case
  958. int av_get_bits_per_sample(enum CodecID codec_id){
  959.     switch(codec_id){
  960.     case CODEC_ID_ADPCM_SBPRO_2:
           ^
  961.         return 2;
  962.     case CODEC_ID_ADPCM_SBPRO_3:

libavcodec/utils.c:962:5: Switch condition is false. Skipping switch case
  960.     case CODEC_ID_ADPCM_SBPRO_2:
  961.         return 2;
  962.     case CODEC_ID_ADPCM_SBPRO_3:
           ^
  963.         return 3;
  964.     case CODEC_ID_ADPCM_SBPRO_4:

libavcodec/utils.c:964:5: Switch condition is false. Skipping switch case
  962.     case CODEC_ID_ADPCM_SBPRO_3:
  963.         return 3;
  964.     case CODEC_ID_ADPCM_SBPRO_4:
           ^
  965.     case CODEC_ID_ADPCM_CT:
  966.     case CODEC_ID_ADPCM_IMA_WAV:

libavcodec/utils.c:965:5: Switch condition is false. Skipping switch case
  963.         return 3;
  964.     case CODEC_ID_ADPCM_SBPRO_4:
  965.     case CODEC_ID_ADPCM_CT:
           ^
  966.     case CODEC_ID_ADPCM_IMA_WAV:
  967.     case CODEC_ID_ADPCM_MS:

libavcodec/utils.c:966:5: Switch condition is false. Skipping switch case
  964.     case CODEC_ID_ADPCM_SBPRO_4:
  965.     case CODEC_ID_ADPCM_CT:
  966.     case CODEC_ID_ADPCM_IMA_WAV:
           ^
  967.     case CODEC_ID_ADPCM_MS:
  968.     case CODEC_ID_ADPCM_YAMAHA:

libavcodec/utils.c:967:5: Switch condition is false. Skipping switch case
  965.     case CODEC_ID_ADPCM_CT:
  966.     case CODEC_ID_ADPCM_IMA_WAV:
  967.     case CODEC_ID_ADPCM_MS:
           ^
  968.     case CODEC_ID_ADPCM_YAMAHA:
  969.         return 4;

libavcodec/utils.c:968:5: Switch condition is false. Skipping switch case
  966.     case CODEC_ID_ADPCM_IMA_WAV:
  967.     case CODEC_ID_ADPCM_MS:
  968.     case CODEC_ID_ADPCM_YAMAHA:
           ^
  969.         return 4;
  970.     case CODEC_ID_PCM_ALAW:

libavcodec/utils.c:970:5: Switch condition is false. Skipping switch case
  968.     case CODEC_ID_ADPCM_YAMAHA:
  969.         return 4;
  970.     case CODEC_ID_PCM_ALAW:
           ^
  971.     case CODEC_ID_PCM_MULAW:
  972.     case CODEC_ID_PCM_S8:

libavcodec/utils.c:971:5: Switch condition is false. Skipping switch case
  969.         return 4;
  970.     case CODEC_ID_PCM_ALAW:
  971.     case CODEC_ID_PCM_MULAW:
           ^
  972.     case CODEC_ID_PCM_S8:
  973.     case CODEC_ID_PCM_U8:

libavcodec/utils.c:972:5: Switch condition is false. Skipping switch case
  970.     case CODEC_ID_PCM_ALAW:
  971.     case CODEC_ID_PCM_MULAW:
  972.     case CODEC_ID_PCM_S8:
           ^
  973.     case CODEC_ID_PCM_U8:
  974.     case CODEC_ID_PCM_ZORK:

libavcodec/utils.c:973:5: Switch condition is false. Skipping switch case
  971.     case CODEC_ID_PCM_MULAW:
  972.     case CODEC_ID_PCM_S8:
  973.     case CODEC_ID_PCM_U8:
           ^
  974.     case CODEC_ID_PCM_ZORK:
  975.         return 8;

libavcodec/utils.c:974:5: Switch condition is false. Skipping switch case
  972.     case CODEC_ID_PCM_S8:
  973.     case CODEC_ID_PCM_U8:
  974.     case CODEC_ID_PCM_ZORK:
           ^
  975.         return 8;
  976.     case CODEC_ID_PCM_S16BE:

libavcodec/utils.c:976:5: Switch condition is false. Skipping switch case
  974.     case CODEC_ID_PCM_ZORK:
  975.         return 8;
  976.     case CODEC_ID_PCM_S16BE:
           ^
  977.     case CODEC_ID_PCM_S16LE:
  978.     case CODEC_ID_PCM_S16LE_PLANAR:

libavcodec/utils.c:977:5: Switch condition is false. Skipping switch case
  975.         return 8;
  976.     case CODEC_ID_PCM_S16BE:
  977.     case CODEC_ID_PCM_S16LE:
           ^
  978.     case CODEC_ID_PCM_S16LE_PLANAR:
  979.     case CODEC_ID_PCM_U16BE:

libavcodec/utils.c:978:5: Switch condition is false. Skipping switch case
  976.     case CODEC_ID_PCM_S16BE:
  977.     case CODEC_ID_PCM_S16LE:
  978.     case CODEC_ID_PCM_S16LE_PLANAR:
           ^
  979.     case CODEC_ID_PCM_U16BE:
  980.     case CODEC_ID_PCM_U16LE:

libavcodec/utils.c:979:5: Switch condition is false. Skipping switch case
  977.     case CODEC_ID_PCM_S16LE:
  978.     case CODEC_ID_PCM_S16LE_PLANAR:
  979.     case CODEC_ID_PCM_U16BE:
           ^
  980.     case CODEC_ID_PCM_U16LE:
  981.         return 16;

libavcodec/utils.c:980:5: Switch condition is false. Skipping switch case
  978.     case CODEC_ID_PCM_S16LE_PLANAR:
  979.     case CODEC_ID_PCM_U16BE:
  980.     case CODEC_ID_PCM_U16LE:
           ^
  981.         return 16;
  982.     case CODEC_ID_PCM_S24DAUD:

libavcodec/utils.c:982:5: Switch condition is false. Skipping switch case
  980.     case CODEC_ID_PCM_U16LE:
  981.         return 16;
  982.     case CODEC_ID_PCM_S24DAUD:
           ^
  983.     case CODEC_ID_PCM_S24BE:
  984.     case CODEC_ID_PCM_S24LE:

libavcodec/utils.c:983:5: Switch condition is false. Skipping switch case
  981.         return 16;
  982.     case CODEC_ID_PCM_S24DAUD:
  983.     case CODEC_ID_PCM_S24BE:
           ^
  984.     case CODEC_ID_PCM_S24LE:
  985.     case CODEC_ID_PCM_U24BE:

libavcodec/utils.c:984:5: Switch condition is false. Skipping switch case
  982.     case CODEC_ID_PCM_S24DAUD:
  983.     case CODEC_ID_PCM_S24BE:
  984.     case CODEC_ID_PCM_S24LE:
           ^
  985.     case CODEC_ID_PCM_U24BE:
  986.     case CODEC_ID_PCM_U24LE:

libavcodec/utils.c:985:5: Switch condition is false. Skipping switch case
  983.     case CODEC_ID_PCM_S24BE:
  984.     case CODEC_ID_PCM_S24LE:
  985.     case CODEC_ID_PCM_U24BE:
           ^
  986.     case CODEC_ID_PCM_U24LE:
  987.         return 24;

libavcodec/utils.c:986:5: Switch condition is false. Skipping switch case
  984.     case CODEC_ID_PCM_S24LE:
  985.     case CODEC_ID_PCM_U24BE:
  986.     case CODEC_ID_PCM_U24LE:
           ^
  987.         return 24;
  988.     case CODEC_ID_PCM_S32BE:

libavcodec/utils.c:988:5: Switch condition is false. Skipping switch case
  986.     case CODEC_ID_PCM_U24LE:
  987.         return 24;
  988.     case CODEC_ID_PCM_S32BE:
           ^
  989.     case CODEC_ID_PCM_S32LE:
  990.     case CODEC_ID_PCM_U32BE:

libavcodec/utils.c:989:5: Switch condition is false. Skipping switch case
  987.         return 24;
  988.     case CODEC_ID_PCM_S32BE:
  989.     case CODEC_ID_PCM_S32LE:
           ^
  990.     case CODEC_ID_PCM_U32BE:
  991.     case CODEC_ID_PCM_U32LE:

libavcodec/utils.c:990:5: Switch condition is false. Skipping switch case
  988.     case CODEC_ID_PCM_S32BE:
  989.     case CODEC_ID_PCM_S32LE:
  990.     case CODEC_ID_PCM_U32BE:
           ^
  991.     case CODEC_ID_PCM_U32LE:
  992.     case CODEC_ID_PCM_F32BE:

libavcodec/utils.c:991:5: Switch condition is false. Skipping switch case
  989.     case CODEC_ID_PCM_S32LE:
  990.     case CODEC_ID_PCM_U32BE:
  991.     case CODEC_ID_PCM_U32LE:
           ^
  992.     case CODEC_ID_PCM_F32BE:
  993.     case CODEC_ID_PCM_F32LE:

libavcodec/utils.c:992:5: Switch condition is false. Skipping switch case
  990.     case CODEC_ID_PCM_U32BE:
  991.     case CODEC_ID_PCM_U32LE:
  992.     case CODEC_ID_PCM_F32BE:
           ^
  993.     case CODEC_ID_PCM_F32LE:
  994.         return 32;

libavcodec/utils.c:993:5: Switch condition is false. Skipping switch case
  991.     case CODEC_ID_PCM_U32LE:
  992.     case CODEC_ID_PCM_F32BE:
  993.     case CODEC_ID_PCM_F32LE:
           ^
  994.         return 32;
  995.     case CODEC_ID_PCM_F64BE:

libavcodec/utils.c:995:5: Switch condition is false. Skipping switch case
  993.     case CODEC_ID_PCM_F32LE:
  994.         return 32;
  995.     case CODEC_ID_PCM_F64BE:
           ^
  996.     case CODEC_ID_PCM_F64LE:
  997.         return 64;

libavcodec/utils.c:996:5: Switch condition is false. Skipping switch case
  994.         return 32;
  995.     case CODEC_ID_PCM_F64BE:
  996.     case CODEC_ID_PCM_F64LE:
           ^
  997.         return 64;
  998.     default:

libavcodec/utils.c:999:9: 
   997.         return 64;
   998.     default:
   999.         return 0;
                ^
  1000.     }
  1001. }

libavcodec/utils.c:1001:1: return from a call to av_get_bits_per_sample
   999.         return 0;
  1000.     }
  1001. }
        ^
  1002. 
  1003. int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {

libavcodec/pcm.c:122:5: 
120. 
121.     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
122.     avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
         ^
123.     avctx->coded_frame= avcodec_alloc_frame();
124.     avctx->coded_frame->key_frame= 1;

libavcodec/pcm.c:123:5: 
121.     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
122.     avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
123.     avctx->coded_frame= avcodec_alloc_frame();
         ^
124.     avctx->coded_frame->key_frame= 1;
125. 

libavcodec/utils.c:425:1: start of procedure avcodec_alloc_frame()
  423. }
  424. 
  425. AVFrame *avcodec_alloc_frame(void){
       ^
  426.     AVFrame *pic= av_malloc(sizeof(AVFrame));
  427. 

libavcodec/utils.c:426:5: 
  424. 
  425. AVFrame *avcodec_alloc_frame(void){
  426.     AVFrame *pic= av_malloc(sizeof(AVFrame));
           ^
  427. 
  428.     if(pic==NULL) return NULL;

libavutil/mem.c:47:1: start of procedure av_malloc()
    45.    linker will do it automatically. */
    46. 
    47. void *av_malloc(unsigned int size)
        ^
    48. {
    49.     void *ptr = NULL;

libavutil/mem.c:49:5: 
    47. void *av_malloc(unsigned int size)
    48. {
    49.     void *ptr = NULL;
            ^
    50. #if CONFIG_MEMALIGN_HACK
    51.     long diff;

libavutil/mem.c:55:8: Taking false branch
    53. 
    54.     /* let's disallow possible ambiguous cases */
    55.     if(size > (INT_MAX-16) )
               ^
    56.         return NULL;
    57. 

libavutil/mem.c:66:9: Taking false branch
    64.     ((char*)ptr)[-1]= diff;
    65. #elif HAVE_POSIX_MEMALIGN
    66.     if (posix_memalign(&ptr,16,size))
                ^
    67.         ptr = NULL;
    68. #elif HAVE_MEMALIGN

libavutil/mem.c:99:5: 
     97.     ptr = malloc(size);
     98. #endif
     99.     return ptr;
             ^
    100. }
    101. 

libavutil/mem.c:100:1: return from a call to av_malloc
     98. #endif
     99.     return ptr;
    100. }
         ^
    101. 
    102. void *av_realloc(void *ptr, unsigned int size)

libavcodec/utils.c:428:8: Taking true branch
  426.     AVFrame *pic= av_malloc(sizeof(AVFrame));
  427. 
  428.     if(pic==NULL) return NULL;
              ^
  429. 
  430.     avcodec_get_frame_defaults(pic);

libavcodec/utils.c:428:19: 
  426.     AVFrame *pic= av_malloc(sizeof(AVFrame));
  427. 
  428.     if(pic==NULL) return NULL;
                         ^
  429. 
  430.     avcodec_get_frame_defaults(pic);

libavcodec/utils.c:433:1: return from a call to avcodec_alloc_frame
  431. 
  432.     return pic;
  433. }
       ^
  434. 
  435. int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)

libavcodec/pcm.c:124:5: 
122.     avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
123.     avctx->coded_frame= avcodec_alloc_frame();
124.     avctx->coded_frame->key_frame= 1;
         ^
125. 
126.     return 0;

static av_cold int pcm_encode_init(AVCodecContext *avctx)
{
    avctx->frame_size = 1;
    switch(avctx->codec->id) {
    case CODEC_ID_PCM_ALAW:
        build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
        break;
    case CODEC_ID_PCM_MULAW:
        build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);
        break;
    default:
        break;
    }
    avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
    avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
    avctx->coded_frame= avcodec_alloc_frame();
    avctx->coded_frame->key_frame= 1;
    return 0;
}
['static av_cold int pcm_encode_init(AVCodecContext *avctx)\n{\n    avctx->frame_size = 1;\n    switch(avctx->codec->id) {\n    case CODEC_ID_PCM_ALAW:\n        build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);\n        break;\n    case CODEC_ID_PCM_MULAW:\n        build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);\n        break;\n    default:\n        break;\n    }\n    avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);\n    avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;\n    avctx->coded_frame= avcodec_alloc_frame();\n    avctx->coded_frame->key_frame= 1;\n    return 0;\n}', 'int av_get_bits_per_sample(enum CodecID codec_id){\n    switch(codec_id){\n    case CODEC_ID_ADPCM_SBPRO_2:\n        return 2;\n    case CODEC_ID_ADPCM_SBPRO_3:\n        return 3;\n    case CODEC_ID_ADPCM_SBPRO_4:\n    case CODEC_ID_ADPCM_CT:\n    case CODEC_ID_ADPCM_IMA_WAV:\n    case CODEC_ID_ADPCM_MS:\n    case CODEC_ID_ADPCM_YAMAHA:\n        return 4;\n    case CODEC_ID_PCM_ALAW:\n    case CODEC_ID_PCM_MULAW:\n    case CODEC_ID_PCM_S8:\n    case CODEC_ID_PCM_U8:\n    case CODEC_ID_PCM_ZORK:\n        return 8;\n    case CODEC_ID_PCM_S16BE:\n    case CODEC_ID_PCM_S16LE:\n    case CODEC_ID_PCM_S16LE_PLANAR:\n    case CODEC_ID_PCM_U16BE:\n    case CODEC_ID_PCM_U16LE:\n        return 16;\n    case CODEC_ID_PCM_S24DAUD:\n    case CODEC_ID_PCM_S24BE:\n    case CODEC_ID_PCM_S24LE:\n    case CODEC_ID_PCM_U24BE:\n    case CODEC_ID_PCM_U24LE:\n        return 24;\n    case CODEC_ID_PCM_S32BE:\n    case CODEC_ID_PCM_S32LE:\n    case CODEC_ID_PCM_U32BE:\n    case CODEC_ID_PCM_U32LE:\n    case CODEC_ID_PCM_F32BE:\n    case CODEC_ID_PCM_F32LE:\n        return 32;\n    case CODEC_ID_PCM_F64BE:\n    case CODEC_ID_PCM_F64LE:\n        return 64;\n    default:\n        return 0;\n    }\n}', 'AVFrame *avcodec_alloc_frame(void){\n    AVFrame *pic= av_malloc(sizeof(AVFrame));\n    if(pic==NULL) return NULL;\n    avcodec_get_frame_defaults(pic);\n    return pic;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if 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 HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']