libavformat/oggparsetheora.c:63: error: Null Dereference
  pointer `thp` last assigned on line 51 could be null and is dereferenced at line 63, column 9.

libavformat/oggparsetheora.c:37:1: start of procedure theora_header()
35. };
36. 
37. static int
    ^
38. theora_header (AVFormatContext * s, int idx)
39. {

libavformat/oggparsetheora.c:40:5: 
38. theora_header (AVFormatContext * s, int idx)
39. {
40.     struct ogg *ogg = s->priv_data;
        ^
41.     struct ogg_stream *os = ogg->streams + idx;
42.     AVStream *st = s->streams[idx];

libavformat/oggparsetheora.c:41:5: 
39. {
40.     struct ogg *ogg = s->priv_data;
41.     struct ogg_stream *os = ogg->streams + idx;
        ^
42.     AVStream *st = s->streams[idx];
43.     struct theora_params *thp = os->private;

libavformat/oggparsetheora.c:42:5: 
40.     struct ogg *ogg = s->priv_data;
41.     struct ogg_stream *os = ogg->streams + idx;
42.     AVStream *st = s->streams[idx];
        ^
43.     struct theora_params *thp = os->private;
44.     int cds = st->codec->extradata_size + os->psize + 2;

libavformat/oggparsetheora.c:43:5: 
41.     struct ogg_stream *os = ogg->streams + idx;
42.     AVStream *st = s->streams[idx];
43.     struct theora_params *thp = os->private;
        ^
44.     int cds = st->codec->extradata_size + os->psize + 2;
45.     uint8_t *cdp;

libavformat/oggparsetheora.c:44:5: 
42.     AVStream *st = s->streams[idx];
43.     struct theora_params *thp = os->private;
44.     int cds = st->codec->extradata_size + os->psize + 2;
        ^
45.     uint8_t *cdp;
46. 

libavformat/oggparsetheora.c:47:10: Taking false branch
45.     uint8_t *cdp;
46. 
47.     if(!(os->buf[os->pstart] & 0x80))
             ^
48.         return 0;
49. 

libavformat/oggparsetheora.c:50:9: Taking true branch
48.         return 0;
49. 
50.     if(!thp){
            ^
51.         thp = av_mallocz(sizeof(*thp));
52.         os->private = thp;

libavformat/oggparsetheora.c:51:9: 
49. 
50.     if(!thp){
51.         thp = av_mallocz(sizeof(*thp));
            ^
52.         os->private = thp;
53.     }

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

libavformat/oggparsetheora.c:52:9: 
50.     if(!thp){
51.         thp = av_mallocz(sizeof(*thp));
52.         os->private = thp;
            ^
53.     }
54. 

libavformat/oggparsetheora.c:55:9: Taking true branch
53.     }
54. 
55.     if (os->buf[os->pstart] == 0x80) {
            ^
56.         GetBitContext gb;
57.         int width, height;

libavformat/oggparsetheora.c:59:9: 
57.         int width, height;
58. 
59.         init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
            ^
60. 
61.         skip_bits(&gb, 7*8); /* 0x80"theora" */

libavcodec/bitstream.h:745:1: start of procedure init_get_bits()
  743.  * @param bit_size the size of the buffer in bits
  744.  */
  745. static inline void init_get_bits(GetBitContext *s,
       ^
  746.                    const uint8_t *buffer, int bit_size)
  747. {

libavcodec/bitstream.h:748:5: 
  746.                    const uint8_t *buffer, int bit_size)
  747. {
  748.     int buffer_size= (bit_size+7)>>3;
           ^
  749.     if(buffer_size < 0 || bit_size < 0) {
  750.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:749:8: Taking false branch
  747. {
  748.     int buffer_size= (bit_size+7)>>3;
  749.     if(buffer_size < 0 || bit_size < 0) {
              ^
  750.         buffer_size = bit_size = 0;
  751.         buffer = NULL;

libavcodec/bitstream.h:749:27: Taking false branch
  747. {
  748.     int buffer_size= (bit_size+7)>>3;
  749.     if(buffer_size < 0 || bit_size < 0) {
                                 ^
  750.         buffer_size = bit_size = 0;
  751.         buffer = NULL;

libavcodec/bitstream.h:754:5: 
  752.     }
  753. 
  754.     s->buffer= buffer;
           ^
  755.     s->size_in_bits= bit_size;
  756.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:755:5: 
  753. 
  754.     s->buffer= buffer;
  755.     s->size_in_bits= bit_size;
           ^
  756.     s->buffer_end= buffer + buffer_size;
  757. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:756:5: 
  754.     s->buffer= buffer;
  755.     s->size_in_bits= bit_size;
  756.     s->buffer_end= buffer + buffer_size;
           ^
  757. #ifdef ALT_BITSTREAM_READER
  758.     s->index=0;

libavcodec/bitstream.h:758:5: 
  756.     s->buffer_end= buffer + buffer_size;
  757. #ifdef ALT_BITSTREAM_READER
  758.     s->index=0;
           ^
  759. #elif defined LIBMPEG2_BITSTREAM_READER
  760.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:768:1: return from a call to init_get_bits
  766.     skip_bits_long(s, 0);
  767. #endif
  768. }
       ^
  769. 
  770. static inline void align_get_bits(GetBitContext *s)

libavformat/oggparsetheora.c:61:9: 
59.         init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
60. 
61.         skip_bits(&gb, 7*8); /* 0x80"theora" */
            ^
62. 
63.         thp->version = get_bits_long(&gb, 24);

libavcodec/bitstream.h:665:1: start of procedure skip_bits()
  663. }
  664. 
  665. static inline void skip_bits(GetBitContext *s, int n){
       ^
  666.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  667.     OPEN_READER(re, s)

libavcodec/bitstream.h:667:5: 
  665. static inline void skip_bits(GetBitContext *s, int n){
  666.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  667.     OPEN_READER(re, s)
           ^
  668.     UPDATE_CACHE(re, s)
  669.     LAST_SKIP_BITS(re, s, n)

libavcodec/bitstream.h:668:5: 
  666.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  667.     OPEN_READER(re, s)
  668.     UPDATE_CACHE(re, s)
           ^
  669.     LAST_SKIP_BITS(re, s, n)
  670.     CLOSE_READER(re, s)

libavcodec/bitstream.h:669:5: 
  667.     OPEN_READER(re, s)
  668.     UPDATE_CACHE(re, s)
  669.     LAST_SKIP_BITS(re, s, n)
           ^
  670.     CLOSE_READER(re, s)
  671. }

libavcodec/bitstream.h:670:5: 
  668.     UPDATE_CACHE(re, s)
  669.     LAST_SKIP_BITS(re, s, n)
  670.     CLOSE_READER(re, s)
           ^
  671. }
  672. 

libavcodec/bitstream.h:671:1: return from a call to skip_bits
  669.     LAST_SKIP_BITS(re, s, n)
  670.     CLOSE_READER(re, s)
  671. }
       ^
  672. 
  673. static inline unsigned int get_bits1(GetBitContext *s){

libavformat/oggparsetheora.c:63:9: 
61.         skip_bits(&gb, 7*8); /* 0x80"theora" */
62. 
63.         thp->version = get_bits_long(&gb, 24);
            ^
64.         if (thp->version < 0x030100)
65.         {

libavcodec/bitstream.h:704:1: start of procedure get_bits_long()
  702.  * reads 0-32 bits.
  703.  */
  704. static inline unsigned int get_bits_long(GetBitContext *s, int n){
       ^
  705.     if(n<=17) return get_bits(s, n);
  706.     else{

libavcodec/bitstream.h:705:8: Taking false branch
  703.  */
  704. static inline unsigned int get_bits_long(GetBitContext *s, int n){
  705.     if(n<=17) return get_bits(s, n);
              ^
  706.     else{
  707. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/bitstream.h:711:9: 
  709.         return ret | (get_bits(s, n-16) << 16);
  710. #else
  711.         int ret= get_bits(s, 16) << (n-16);
               ^
  712.         return ret | get_bits(s, n-16);
  713. #endif

libavcodec/bitstream.h:642:1: start of procedure get_bits()
    640.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
    641.  */
    642. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    643.     register int tmp;
    644.     OPEN_READER(re, s)

libavcodec/bitstream.h:644:5: 
    642. static inline unsigned int get_bits(GetBitContext *s, int n){
    643.     register int tmp;
    644.     OPEN_READER(re, s)
             ^
    645.     UPDATE_CACHE(re, s)
    646.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:645:5: 
    643.     register int tmp;
    644.     OPEN_READER(re, s)
    645.     UPDATE_CACHE(re, s)
             ^
    646.     tmp= SHOW_UBITS(re, s, n);
    647.     LAST_SKIP_BITS(re, s, n)

libavcodec/bitstream.h:646:5: 
    644.     OPEN_READER(re, s)
    645.     UPDATE_CACHE(re, s)
    646.     tmp= SHOW_UBITS(re, s, n);
             ^
    647.     LAST_SKIP_BITS(re, s, n)
    648.     CLOSE_READER(re, s)

libavcodec/bitstream.h:647:5: 
    645.     UPDATE_CACHE(re, s)
    646.     tmp= SHOW_UBITS(re, s, n);
    647.     LAST_SKIP_BITS(re, s, n)
             ^
    648.     CLOSE_READER(re, s)
    649.     return tmp;

libavcodec/bitstream.h:648:5: 
    646.     tmp= SHOW_UBITS(re, s, n);
    647.     LAST_SKIP_BITS(re, s, n)
    648.     CLOSE_READER(re, s)
             ^
    649.     return tmp;
    650. }

libavcodec/bitstream.h:649:5: 
    647.     LAST_SKIP_BITS(re, s, n)
    648.     CLOSE_READER(re, s)
    649.     return tmp;
             ^
    650. }
    651. 

libavcodec/bitstream.h:650:1: return from a call to get_bits
    648.     CLOSE_READER(re, s)
    649.     return tmp;
    650. }
         ^
    651. 
    652. /**

libavcodec/bitstream.h:712:9: 
  710. #else
  711.         int ret= get_bits(s, 16) << (n-16);
  712.         return ret | get_bits(s, n-16);
               ^
  713. #endif
  714.     }

libavcodec/bitstream.h:642:1: start of procedure get_bits()
    640.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
    641.  */
    642. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    643.     register int tmp;
    644.     OPEN_READER(re, s)

libavcodec/bitstream.h:644:5: 
    642. static inline unsigned int get_bits(GetBitContext *s, int n){
    643.     register int tmp;
    644.     OPEN_READER(re, s)
             ^
    645.     UPDATE_CACHE(re, s)
    646.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:645:5: 
    643.     register int tmp;
    644.     OPEN_READER(re, s)
    645.     UPDATE_CACHE(re, s)
             ^
    646.     tmp= SHOW_UBITS(re, s, n);
    647.     LAST_SKIP_BITS(re, s, n)

libavcodec/bitstream.h:646:5: 
    644.     OPEN_READER(re, s)
    645.     UPDATE_CACHE(re, s)
    646.     tmp= SHOW_UBITS(re, s, n);
             ^
    647.     LAST_SKIP_BITS(re, s, n)
    648.     CLOSE_READER(re, s)

libavcodec/bitstream.h:647:5: 
    645.     UPDATE_CACHE(re, s)
    646.     tmp= SHOW_UBITS(re, s, n);
    647.     LAST_SKIP_BITS(re, s, n)
             ^
    648.     CLOSE_READER(re, s)
    649.     return tmp;

libavcodec/bitstream.h:648:5: 
    646.     tmp= SHOW_UBITS(re, s, n);
    647.     LAST_SKIP_BITS(re, s, n)
    648.     CLOSE_READER(re, s)
             ^
    649.     return tmp;
    650. }

libavcodec/bitstream.h:649:5: 
    647.     LAST_SKIP_BITS(re, s, n)
    648.     CLOSE_READER(re, s)
    649.     return tmp;
             ^
    650. }
    651. 

libavcodec/bitstream.h:650:1: return from a call to get_bits
    648.     CLOSE_READER(re, s)
    649.     return tmp;
    650. }
         ^
    651. 
    652. /**

libavcodec/bitstream.h:715:1: return from a call to get_bits_long
  713. #endif
  714.     }
  715. }
       ^
  716. 
  717. /**
