libavcodec/sonic.c:422: error: Null Dereference
  pointer `state` last assigned on line 420 could be null and is dereferenced by call to `memcpy()` at line 422, column 5.

libavcodec/sonic.c:416:1: start of procedure modified_levinson_durbin()
414. // actual whitened result as it goes.
415. 
416. static void modified_levinson_durbin(int *window, int window_entries,
     ^
417.         int *out, int out_entries, int channels, int *tap_quant)
418. {

libavcodec/sonic.c:420:5: 
418. {
419.     int i;
420.     int *state = av_mallocz(4* window_entries);
         ^
421. 
422.     memcpy(state, window, 4* window_entries);

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 true branch
    48. 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
               ^
    51.         return NULL;
    52. 

libavutil/mem.c:51:9: 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
    51.         return NULL;
                ^
    52. 
    53. #ifdef CONFIG_MEMALIGN_HACK

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/sonic.c:422:5: 
420.     int *state = av_mallocz(4* window_entries);
421. 
422.     memcpy(state, window, 4* window_entries);
         ^
423. 
424.     for (i = 0; i < out_entries; i++)

static void modified_levinson_durbin(int *window, int window_entries,
        int *out, int out_entries, int channels, int *tap_quant)
{
    int i;
    int *state = av_mallocz(4* window_entries);
    memcpy(state, window, 4* window_entries);
    for (i = 0; i < out_entries; i++)
    {
        int step = (i+1)*channels, k, j;
        double xx = 0.0, xy = 0.0;
#if 1
        int *x_ptr = &(window[step]), *state_ptr = &(state[0]);
        j = window_entries - step;
        for (;j>=0;j--,x_ptr++,state_ptr++)
        {
            double x_value = *x_ptr, state_value = *state_ptr;
            xx += state_value*state_value;
            xy += x_value*state_value;
        }
#else
        for (j = 0; j <= (window_entries - step); j++);
        {
            double stepval = window[step+j], stateval = window[j];
            xx += stateval*stateval;
            xy += stepval*stateval;
        }
#endif
        if (xx == 0.0)
            k = 0;
        else
            k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));
        if (k > (LATTICE_FACTOR/tap_quant[i]))
            k = LATTICE_FACTOR/tap_quant[i];
        if (-k > (LATTICE_FACTOR/tap_quant[i]))
            k = -(LATTICE_FACTOR/tap_quant[i]);
        out[i] = k;
        k *= tap_quant[i];
#if 1
        x_ptr = &(window[step]);
        state_ptr = &(state[0]);
        j = window_entries - step;
        for (;j>=0;j--,x_ptr++,state_ptr++)
        {
            int x_value = *x_ptr, state_value = *state_ptr;
            *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);
            *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);
        }
#else
        for (j=0; j <= (window_entries - step); j++)
        {
            int stepval = window[step+j], stateval=state[j];
            window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);
            state[j] += shift_down(k * stepval, LATTICE_SHIFT);
        }
#endif
    }
    av_free(state);
}
['static void modified_levinson_durbin(int *window, int window_entries,\n        int *out, int out_entries, int channels, int *tap_quant)\n{\n    int i;\n    int *state = av_mallocz(4* window_entries);\n    memcpy(state, window, 4* window_entries);\n    for (i = 0; i < out_entries; i++)\n    {\n        int step = (i+1)*channels, k, j;\n        double xx = 0.0, xy = 0.0;\n#if 1\n        int *x_ptr = &(window[step]), *state_ptr = &(state[0]);\n        j = window_entries - step;\n        for (;j>=0;j--,x_ptr++,state_ptr++)\n        {\n            double x_value = *x_ptr, state_value = *state_ptr;\n            xx += state_value*state_value;\n            xy += x_value*state_value;\n        }\n#else\n        for (j = 0; j <= (window_entries - step); j++);\n        {\n            double stepval = window[step+j], stateval = window[j];\n            xx += stateval*stateval;\n            xy += stepval*stateval;\n        }\n#endif\n        if (xx == 0.0)\n            k = 0;\n        else\n            k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));\n        if (k > (LATTICE_FACTOR/tap_quant[i]))\n            k = LATTICE_FACTOR/tap_quant[i];\n        if (-k > (LATTICE_FACTOR/tap_quant[i]))\n            k = -(LATTICE_FACTOR/tap_quant[i]);\n        out[i] = k;\n        k *= tap_quant[i];\n#if 1\n        x_ptr = &(window[step]);\n        state_ptr = &(state[0]);\n        j = window_entries - step;\n        for (;j>=0;j--,x_ptr++,state_ptr++)\n        {\n            int x_value = *x_ptr, state_value = *state_ptr;\n            *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);\n            *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);\n        }\n#else\n        for (j=0; j <= (window_entries - step); j++)\n        {\n            int stepval = window[step+j], stateval=state[j];\n            window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);\n            state[j] += shift_down(k * stepval, LATTICE_SHIFT);\n        }\n#endif\n    }\n    av_free(state);\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}']