libavformat/cutils.c:39: error: Null Dereference
  pointer `tab` last assigned on line 36 could be null and is dereferenced at line 39, column 5.

libavformat/cutils.c:24:1: start of procedure __dynarray_add()
22. 
23. /* add one element to a dynamic array */
24. void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem)
    ^
25. {
26.     int nb, nb_alloc;

libavformat/cutils.c:29:5: 
27.     unsigned long *tab;
28. 
29.     nb = *nb_ptr;
        ^
30.     tab = *tab_ptr;
31.     if ((nb & (nb - 1)) == 0) {

libavformat/cutils.c:30:5: 
28. 
29.     nb = *nb_ptr;
30.     tab = *tab_ptr;
        ^
31.     if ((nb & (nb - 1)) == 0) {
32.         if (nb == 0)

libavformat/cutils.c:31:9: Taking true branch
29.     nb = *nb_ptr;
30.     tab = *tab_ptr;
31.     if ((nb & (nb - 1)) == 0) {
            ^
32.         if (nb == 0)
33.             nb_alloc = 1;

libavformat/cutils.c:32:13: Taking false branch
30.     tab = *tab_ptr;
31.     if ((nb & (nb - 1)) == 0) {
32.         if (nb == 0)
                ^
33.             nb_alloc = 1;
34.         else

libavformat/cutils.c:35:13: 
33.             nb_alloc = 1;
34.         else
35.             nb_alloc = nb * 2;
                ^
36.         tab = av_realloc(tab, nb_alloc * sizeof(unsigned long));
37.         *tab_ptr = tab;

libavformat/cutils.c:36:9: 
34.         else
35.             nb_alloc = nb * 2;
36.         tab = av_realloc(tab, nb_alloc * sizeof(unsigned long));
            ^
37.         *tab_ptr = tab;
38.     }

libavutil/mem.c:94:1: start of procedure av_realloc()
  92. }
  93. 
  94. void *av_realloc(void *ptr, unsigned int size)
      ^
  95. {
  96. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:101:8: Taking false branch
   99. 
  100.     /* let's disallow possible ambiguous cases */
  101.     if(size > (INT_MAX-16) )
              ^
  102.         return NULL;
  103. 

libavutil/mem.c:110:5: 
  108.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
  109. #else
  110.     return realloc(ptr, size);
           ^
  111. #endif
  112. }

libavutil/mem.c:112:1: return from a call to av_realloc
  110.     return realloc(ptr, size);
  111. #endif
  112. }
       ^
  113. 
  114. void av_free(void *ptr)

libavformat/cutils.c:37:9: 
35.             nb_alloc = nb * 2;
36.         tab = av_realloc(tab, nb_alloc * sizeof(unsigned long));
37.         *tab_ptr = tab;
            ^
38.     }
39.     tab[nb++] = elem;

libavformat/cutils.c:39:5: 
37.         *tab_ptr = tab;
38.     }
39.     tab[nb++] = elem;
        ^
40.     *nb_ptr = nb;
41. }
