libavcodec/snow.c:518: error: Null Dereference
  pointer `buf->data_stack` last assigned on line 515 could be null and is dereferenced at line 518, column 9.

libavcodec/snow.c:506:1: start of procedure slice_buffer_init()
504. static void iterative_me(SnowContext *s);
505. 
506. static void slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer)
     ^
507. {
508.     int i;

libavcodec/snow.c:510:5: 
508.     int i;
509. 
510.     buf->base_buffer = base_buffer;
         ^
511.     buf->line_count = line_count;
512.     buf->line_width = line_width;

libavcodec/snow.c:511:5: 
509. 
510.     buf->base_buffer = base_buffer;
511.     buf->line_count = line_count;
         ^
512.     buf->line_width = line_width;
513.     buf->data_count = max_allocated_lines;

libavcodec/snow.c:512:5: 
510.     buf->base_buffer = base_buffer;
511.     buf->line_count = line_count;
512.     buf->line_width = line_width;
         ^
513.     buf->data_count = max_allocated_lines;
514.     buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);

libavcodec/snow.c:513:5: 
511.     buf->line_count = line_count;
512.     buf->line_width = line_width;
513.     buf->data_count = max_allocated_lines;
         ^
514.     buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);
515.     buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);

libavcodec/snow.c:514:5: 
512.     buf->line_width = line_width;
513.     buf->data_count = max_allocated_lines;
514.     buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);
         ^
515.     buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
516. 

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 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)

libavutil/mem.c:135:9: Taking true branch
  133. {
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
               ^
  136.         memset(ptr, 0, size);
  137.     return ptr;

libavutil/mem.c:136:9: 
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
  136.         memset(ptr, 0, size);
               ^
  137.     return ptr;
  138. }

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/snow.c:515:5: 
513.     buf->data_count = max_allocated_lines;
514.     buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);
515.     buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
         ^
516. 
517.     for(i = 0; i < max_allocated_lines; i++){

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/snow.c:517:9: 
515.     buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
516. 
517.     for(i = 0; i < max_allocated_lines; i++){
             ^
518.         buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);
519.     }

libavcodec/snow.c:517:16: Loop condition is true. Entering loop body
515.     buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
516. 
517.     for(i = 0; i < max_allocated_lines; i++){
                    ^
518.         buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);
519.     }

libavcodec/snow.c:518:9: 
516. 
517.     for(i = 0; i < max_allocated_lines; i++){
518.         buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);
             ^
519.     }
520. 

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)

static void slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer)
{
    int i;
    buf->base_buffer = base_buffer;
    buf->line_count = line_count;
    buf->line_width = line_width;
    buf->data_count = max_allocated_lines;
    buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);
    buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
    for(i = 0; i < max_allocated_lines; i++){
        buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);
    }
    buf->data_stack_top = max_allocated_lines - 1;
}
['static void slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer)\n{\n    int i;\n    buf->base_buffer = base_buffer;\n    buf->line_count = line_count;\n    buf->line_width = line_width;\n    buf->data_count = max_allocated_lines;\n    buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);\n    buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);\n    for(i = 0; i < max_allocated_lines; i++){\n        buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);\n    }\n    buf->data_stack_top = max_allocated_lines - 1;\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}']