libavcodec/flacenc.c:525: error: Null Dereference
  pointer `udata` last assigned on line 523 could be null and is dereferenced at line 525, column 9.

libavcodec/flacenc.c:509:1: start of procedure calc_rice_params()
507. }
508. 
509. static uint32_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
     ^
510.                                  int32_t *data, int n, int pred_order)
511. {

libavcodec/flacenc.c:519:5: 
517.     uint32_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS];
518. 
519.     assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
         ^
520.     assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
521.     assert(pmin <= pmax);

libavcodec/flacenc.c:520:5: 
518. 
519.     assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
520.     assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
         ^
521.     assert(pmin <= pmax);
522. 

libavcodec/flacenc.c:521:5: 
519.     assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
520.     assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
521.     assert(pmin <= pmax);
         ^
522. 
523.     udata = av_malloc(n * sizeof(uint32_t));

libavcodec/flacenc.c:523:5: 
521.     assert(pmin <= pmax);
522. 
523.     udata = av_malloc(n * sizeof(uint32_t));
         ^
524.     for(i=0; i<n; i++) {
525.         udata[i] = (2*data[i]) ^ (data[i]>>31);

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)

libavcodec/flacenc.c:524:9: 
522. 
523.     udata = av_malloc(n * sizeof(uint32_t));
524.     for(i=0; i<n; i++) {
             ^
525.         udata[i] = (2*data[i]) ^ (data[i]>>31);
526.     }

libavcodec/flacenc.c:524:14: Loop condition is true. Entering loop body
522. 
523.     udata = av_malloc(n * sizeof(uint32_t));
524.     for(i=0; i<n; i++) {
                  ^
525.         udata[i] = (2*data[i]) ^ (data[i]>>31);
526.     }

libavcodec/flacenc.c:525:9: 
523.     udata = av_malloc(n * sizeof(uint32_t));
524.     for(i=0; i<n; i++) {
525.         udata[i] = (2*data[i]) ^ (data[i]>>31);
             ^
526.     }
527. 

static uint32_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
                                 int32_t *data, int n, int pred_order)
{
    int i;
    uint32_t bits[MAX_PARTITION_ORDER+1];
    int opt_porder;
    RiceContext tmp_rc;
    uint32_t *udata;
    uint32_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS];
    assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
    assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
    assert(pmin <= pmax);
    udata = av_malloc(n * sizeof(uint32_t));
    for(i=0; i<n; i++) {
        udata[i] = (2*data[i]) ^ (data[i]>>31);
    }
    calc_sums(pmin, pmax, udata, n, pred_order, sums);
    opt_porder = pmin;
    bits[pmin] = UINT32_MAX;
    for(i=pmin; i<=pmax; i++) {
        bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums[i], n, pred_order);
        if(bits[i] <= bits[opt_porder]) {
            opt_porder = i;
            *rc= tmp_rc;
        }
    }
    av_freep(&udata);
    return bits[opt_porder];
}
['static uint32_t calc_rice_params(RiceContext *rc, int pmin, int pmax,\n                                 int32_t *data, int n, int pred_order)\n{\n    int i;\n    uint32_t bits[MAX_PARTITION_ORDER+1];\n    int opt_porder;\n    RiceContext tmp_rc;\n    uint32_t *udata;\n    uint32_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS];\n    assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);\n    assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);\n    assert(pmin <= pmax);\n    udata = av_malloc(n * sizeof(uint32_t));\n    for(i=0; i<n; i++) {\n        udata[i] = (2*data[i]) ^ (data[i]>>31);\n    }\n    calc_sums(pmin, pmax, udata, n, pred_order, sums);\n    opt_porder = pmin;\n    bits[pmin] = UINT32_MAX;\n    for(i=pmin; i<=pmax; i++) {\n        bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums[i], n, pred_order);\n        if(bits[i] <= bits[opt_porder]) {\n            opt_porder = i;\n            *rc= tmp_rc;\n        }\n    }\n    av_freep(&udata);\n    return bits[opt_porder];\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}']