libavcodec/iirfilter.c:72: error: Null Dereference
  pointer `c->cx` last assigned on line 66 could be null and is dereferenced at line 72, column 5.

libavcodec/iirfilter.c:50:9: start of procedure ff_iir_filter_init_coeffs()
48. #define MAXORDER 30
49. 
50. av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
            ^
51.                                                     enum IIRFilterMode filt_mode,
52.                                                     int order, float cutoff_ratio,

libavcodec/iirfilter.c:60:8: Taking false branch
58.     double p[MAXORDER + 1][2];
59. 
60.     if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
           ^
61.         return NULL;
62.     if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)

libavcodec/iirfilter.c:60:51: Taking false branch
58.     double p[MAXORDER + 1][2];
59. 
60.     if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
                                                      ^
61.         return NULL;
62.     if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)

libavcodec/iirfilter.c:62:8: Taking false branch
60.     if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
61.         return NULL;
62.     if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
           ^
63.         return NULL;
64. 

libavcodec/iirfilter.c:62:23: Taking false branch
60.     if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
61.         return NULL;
62.     if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
                          ^
63.         return NULL;
64. 

libavcodec/iirfilter.c:62:37: Taking false branch
60.     if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
61.         return NULL;
62.     if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
                                        ^
63.         return NULL;
64. 

libavcodec/iirfilter.c:62:57: Taking false branch
60.     if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
61.         return NULL;
62.     if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
                                                            ^
63.         return NULL;
64. 

libavcodec/iirfilter.c:65:5: 
63.         return NULL;
64. 
65.     c = av_malloc(sizeof(FFIIRFilterCoeffs));
        ^
66.     c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
67.     c->cy = av_malloc(sizeof(c->cy[0]) * order);

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/iirfilter.c:66:5: 
64. 
65.     c = av_malloc(sizeof(FFIIRFilterCoeffs));
66.     c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
        ^
67.     c->cy = av_malloc(sizeof(c->cy[0]) * order);
68.     c->order = order;

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 true branch
  53. 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
             ^
  56.         return NULL;
  57. 

libavutil/mem.c:56:9: 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
  56.         return NULL;
              ^
  57. 
  58. #if CONFIG_MEMALIGN_HACK

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/iirfilter.c:67:5: 
65.     c = av_malloc(sizeof(FFIIRFilterCoeffs));
66.     c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
67.     c->cy = av_malloc(sizeof(c->cy[0]) * order);
        ^
68.     c->order = order;
69. 

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/iirfilter.c:68:5: 
66.     c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
67.     c->cy = av_malloc(sizeof(c->cy[0]) * order);
68.     c->order = order;
        ^
69. 
70.     wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);

libavcodec/iirfilter.c:70:5: 
68.     c->order = order;
69. 
70.     wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);
        ^
71. 
72.     c->cx[0] = 1;

libavcodec/iirfilter.c:72:5: 
70.     wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);
71. 
72.     c->cx[0] = 1;
        ^
73.     for(i = 1; i < (order >> 1) + 1; i++)
74.         c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i;

struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
                                                    enum IIRFilterMode filt_mode,
                                                    int order, float cutoff_ratio,
                                                    float stopband, float ripple)
{
    int i, j;
    FFIIRFilterCoeffs *c;
    double wa;
    double p[MAXORDER + 1][2];
    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
        return NULL;
    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
        return NULL;
    c = av_malloc(sizeof(FFIIRFilterCoeffs));
    c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
    c->cy = av_malloc(sizeof(c->cy[0]) * order);
    c->order = order;
    wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);
    c->cx[0] = 1;
    for(i = 1; i < (order >> 1) + 1; i++)
        c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i;
    p[0][0] = 1.0;
    p[0][1] = 0.0;
    for(i = 1; i <= order; i++)
        p[i][0] = p[i][1] = 0.0;
    for(i = 0; i < order; i++){
        double zp[2];
        double th = (i + (order >> 1) + 0.5) * M_PI / order;
        double a_re, a_im, c_re, c_im;
        zp[0] = cos(th) * wa;
        zp[1] = sin(th) * wa;
        a_re = zp[0] + 2.0;
        c_re = zp[0] - 2.0;
        a_im =
        c_im = zp[1];
        zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im);
        zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im);
        for(j = order; j >= 1; j--)
        {
            a_re = p[j][0];
            a_im = p[j][1];
            p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0];
            p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1];
        }
        a_re    = p[0][0]*zp[0] - p[0][1]*zp[1];
        p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0];
        p[0][0] = a_re;
    }
    c->gain = p[order][0];
    for(i = 0; i < order; i++){
        c->gain += p[i][0];
        c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) /
                   (p[order][0] * p[order][0] + p[order][1] * p[order][1]);
    }
    c->gain /= 1 << order;
    return c;
}
['struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,\n                                                    enum IIRFilterMode filt_mode,\n                                                    int order, float cutoff_ratio,\n                                                    float stopband, float ripple)\n{\n    int i, j;\n    FFIIRFilterCoeffs *c;\n    double wa;\n    double p[MAXORDER + 1][2];\n    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)\n        return NULL;\n    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)\n        return NULL;\n    c = av_malloc(sizeof(FFIIRFilterCoeffs));\n    c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));\n    c->cy = av_malloc(sizeof(c->cy[0]) * order);\n    c->order = order;\n    wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);\n    c->cx[0] = 1;\n    for(i = 1; i < (order >> 1) + 1; i++)\n        c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i;\n    p[0][0] = 1.0;\n    p[0][1] = 0.0;\n    for(i = 1; i <= order; i++)\n        p[i][0] = p[i][1] = 0.0;\n    for(i = 0; i < order; i++){\n        double zp[2];\n        double th = (i + (order >> 1) + 0.5) * M_PI / order;\n        double a_re, a_im, c_re, c_im;\n        zp[0] = cos(th) * wa;\n        zp[1] = sin(th) * wa;\n        a_re = zp[0] + 2.0;\n        c_re = zp[0] - 2.0;\n        a_im =\n        c_im = zp[1];\n        zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im);\n        zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im);\n        for(j = order; j >= 1; j--)\n        {\n            a_re = p[j][0];\n            a_im = p[j][1];\n            p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0];\n            p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1];\n        }\n        a_re    = p[0][0]*zp[0] - p[0][1]*zp[1];\n        p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0];\n        p[0][0] = a_re;\n    }\n    c->gain = p[order][0];\n    for(i = 0; i < order; i++){\n        c->gain += p[i][0];\n        c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) /\n                   (p[order][0] * p[order][0] + p[order][1] * p[order][1]);\n    }\n    c->gain /= 1 << order;\n    return c;\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}']