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

libavcodec/roqaudioenc.c:52:1: start of procedure roq_dpcm_encode_init()
50. }
51. 
52. static int roq_dpcm_encode_init(AVCodecContext *avctx)
    ^
53. {
54.     ROQDPCMContext_t *context = avctx->priv_data;

libavcodec/roqaudioenc.c:54:5: 
52. static int roq_dpcm_encode_init(AVCodecContext *avctx)
53. {
54.     ROQDPCMContext_t *context = avctx->priv_data;
        ^
55. 
56.     if (avctx->channels > 2) {

libavcodec/roqaudioenc.c:56:9: Taking false branch
54.     ROQDPCMContext_t *context = avctx->priv_data;
55. 
56.     if (avctx->channels > 2) {
            ^
57.         av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
58.         return -1;

libavcodec/roqaudioenc.c:60:9: Taking false branch
58.         return -1;
59.     }
60.     if (avctx->sample_rate != 22050) {
            ^
61.         av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
62.         return -1;

libavcodec/roqaudioenc.c:64:9: Taking false branch
62.         return -1;
63.     }
64.     if (avctx->sample_fmt != SAMPLE_FMT_S16) {
            ^
65.         av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
66.         return -1;

libavcodec/roqaudioenc.c:69:5: 
67.     }
68. 
69.     roq_dpcm_table_init();
        ^
70. 
71.     avctx->frame_size = ROQ_FIRST_FRAME_SIZE;

libavcodec/roqaudioenc.c:40:1: start of procedure roq_dpcm_table_init()
  38. } ROQDPCMContext_t;
  39. 
  40. static av_cold void roq_dpcm_table_init(void)
      ^
  41. {
  42.     int i;

libavcodec/roqaudioenc.c:45:10: 
  43. 
  44.     /* Create a table of quick DPCM values */
  45.     for (i=0; i<MAX_DPCM; i++) {
               ^
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;

libavcodec/roqaudioenc.c:45:15: Loop condition is true. Entering loop body
  43. 
  44.     /* Create a table of quick DPCM values */
  45.     for (i=0; i<MAX_DPCM; i++) {
                    ^
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;

libavcodec/roqaudioenc.c:46:9: 
  44.     /* Create a table of quick DPCM values */
  45.     for (i=0; i<MAX_DPCM; i++) {
  46.         int s= ff_sqrt(i);
              ^
  47.         int mid= s*s + s;
  48.         dpcmValues[i]= s + (i>mid);

libavutil/internal.h:177:1: start of procedure ff_sqrt()
    175. static inline int av_log2_16bit(unsigned int v);
    176. 
    177. static inline av_const unsigned int ff_sqrt(unsigned int a)
         ^
    178. {
    179.     unsigned int b;

libavutil/internal.h:181:8: Taking true branch
    179.     unsigned int b;
    180. 
    181.     if(a<255) return (ff_sqrt_tab[a+1]-1)>>4;
                ^
    182.     else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2;
    183. #ifndef CONFIG_SMALL

libavutil/internal.h:181:15: 
    179.     unsigned int b;
    180. 
    181.     if(a<255) return (ff_sqrt_tab[a+1]-1)>>4;
                       ^
    182.     else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2;
    183. #ifndef CONFIG_SMALL

libavutil/internal.h:195:1: return from a call to ff_sqrt
    193. 
    194.     return b - (a<b*b);
    195. }
         ^
    196. 
    197. #if defined(ARCH_X86)

libavcodec/roqaudioenc.c:47:9: 
  45.     for (i=0; i<MAX_DPCM; i++) {
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;
              ^
  48.         dpcmValues[i]= s + (i>mid);
  49.     }

libavcodec/roqaudioenc.c:48:29: Condition is true
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;
  48.         dpcmValues[i]= s + (i>mid);
                                  ^
  49.     }
  50. }

libavcodec/roqaudioenc.c:48:9: 
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;
  48.         dpcmValues[i]= s + (i>mid);
              ^
  49.     }
  50. }

libavcodec/roqaudioenc.c:45:27: 
  43. 
  44.     /* Create a table of quick DPCM values */
  45.     for (i=0; i<MAX_DPCM; i++) {
                                ^
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;

libavcodec/roqaudioenc.c:45:15: Loop condition is false. Leaving loop
  43. 
  44.     /* Create a table of quick DPCM values */
  45.     for (i=0; i<MAX_DPCM; i++) {
                    ^
  46.         int s= ff_sqrt(i);
  47.         int mid= s*s + s;

libavcodec/roqaudioenc.c:50:1: return from a call to roq_dpcm_table_init
  48.         dpcmValues[i]= s + (i>mid);
  49.     }
  50. }
      ^
  51. 
  52. static int roq_dpcm_encode_init(AVCodecContext *avctx)

libavcodec/roqaudioenc.c:71:5: 
69.     roq_dpcm_table_init();
70. 
71.     avctx->frame_size = ROQ_FIRST_FRAME_SIZE;
        ^
72. 
73.     context->lastSample[0] = context->lastSample[1] = 0;

libavcodec/roqaudioenc.c:73:5: 
71.     avctx->frame_size = ROQ_FIRST_FRAME_SIZE;
72. 
73.     context->lastSample[0] = context->lastSample[1] = 0;
        ^
74. 
75.     avctx->coded_frame= avcodec_alloc_frame();

libavcodec/roqaudioenc.c:75:5: 
73.     context->lastSample[0] = context->lastSample[1] = 0;
74. 
75.     avctx->coded_frame= avcodec_alloc_frame();
        ^
76.     avctx->coded_frame->key_frame= 1;
77. 

libavcodec/utils.c:831:1: start of procedure avcodec_alloc_frame()
  829. }
  830. 
  831. AVFrame *avcodec_alloc_frame(void){
       ^
  832.     AVFrame *pic= av_malloc(sizeof(AVFrame));
  833. 

libavcodec/utils.c:832:5: 
  830. 
  831. AVFrame *avcodec_alloc_frame(void){
  832.     AVFrame *pic= av_malloc(sizeof(AVFrame));
           ^
  833. 
  834.     if(pic==NULL) return NULL;

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)

libavcodec/utils.c:834:8: Taking true branch
  832.     AVFrame *pic= av_malloc(sizeof(AVFrame));
  833. 
  834.     if(pic==NULL) return NULL;
              ^
  835. 
  836.     avcodec_get_frame_defaults(pic);

libavcodec/utils.c:834:19: 
  832.     AVFrame *pic= av_malloc(sizeof(AVFrame));
  833. 
  834.     if(pic==NULL) return NULL;
                         ^
  835. 
  836.     avcodec_get_frame_defaults(pic);

libavcodec/utils.c:839:1: return from a call to avcodec_alloc_frame
  837. 
  838.     return pic;
  839. }
       ^
  840. 
  841. int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)

libavcodec/roqaudioenc.c:76:5: 
74. 
75.     avctx->coded_frame= avcodec_alloc_frame();
76.     avctx->coded_frame->key_frame= 1;
        ^
77. 
78.     return 0;

static int roq_dpcm_encode_init(AVCodecContext *avctx)
{
    ROQDPCMContext_t *context = avctx->priv_data;
    if (avctx->channels > 2) {
        av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
        return -1;
    }
    if (avctx->sample_rate != 22050) {
        av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
        return -1;
    }
    if (avctx->sample_fmt != SAMPLE_FMT_S16) {
        av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
        return -1;
    }
    roq_dpcm_table_init();
    avctx->frame_size = ROQ_FIRST_FRAME_SIZE;
    context->lastSample[0] = context->lastSample[1] = 0;
    avctx->coded_frame= avcodec_alloc_frame();
    avctx->coded_frame->key_frame= 1;
    return 0;
}
['static int roq_dpcm_encode_init(AVCodecContext *avctx)\n{\n    ROQDPCMContext_t *context = avctx->priv_data;\n    if (avctx->channels > 2) {\n        av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\\n");\n        return -1;\n    }\n    if (avctx->sample_rate != 22050) {\n        av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\\n");\n        return -1;\n    }\n    if (avctx->sample_fmt != SAMPLE_FMT_S16) {\n        av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\\n");\n        return -1;\n    }\n    roq_dpcm_table_init();\n    avctx->frame_size = ROQ_FIRST_FRAME_SIZE;\n    context->lastSample[0] = context->lastSample[1] = 0;\n    avctx->coded_frame= avcodec_alloc_frame();\n    avctx->coded_frame->key_frame= 1;\n    return 0;\n}', 'static av_cold void roq_dpcm_table_init(void)\n{\n    int i;\n    for (i=0; i<MAX_DPCM; i++) {\n        int s= ff_sqrt(i);\n        int mid= s*s + s;\n        dpcmValues[i]= s + (i>mid);\n    }\n}', 'static inline av_const unsigned int ff_sqrt(unsigned int a)\n{\n    unsigned int b;\n    if(a<255) return (ff_sqrt_tab[a+1]-1)>>4;\n    else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2;\n#ifndef CONFIG_SMALL\n    else if(a<(1<<14)) b= ff_sqrt_tab[a>>6 ]>>1;\n    else if(a<(1<<16)) b= ff_sqrt_tab[a>>8 ]   ;\n#endif\n    else{\n        int s= av_log2_16bit(a>>16)>>1;\n        unsigned int c= a>>(s+2);\n        b= ff_sqrt_tab[c>>(s+8)];\n        b= FASTDIV(c,b) + (b<<s);\n    }\n    return b - (a<b*b);\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;\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}']