libavformat/oggparsevorbis.c:184: error: Null Dereference
  pointer `ptr` last assigned on line 182 could be null and is dereferenced at line 184, column 5.

libavformat/oggparsevorbis.c:174:1: start of procedure fixup_vorbis_headers()
172. 
173. 
174. static unsigned int
     ^
175. fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,
176.                      uint8_t **buf)

libavformat/oggparsevorbis.c:181:5: 
179.     unsigned char *ptr;
180. 
181.     len = priv->len[0] + priv->len[1] + priv->len[2];
         ^
182.     ptr = *buf = av_mallocz(len + len/255 + 64);
183. 

libavformat/oggparsevorbis.c:182:5: 
180. 
181.     len = priv->len[0] + priv->len[1] + priv->len[2];
182.     ptr = *buf = av_mallocz(len + len/255 + 64);
         ^
183. 
184.     ptr[0] = 2;

libavutil/mem.c:157:1: start of procedure av_mallocz()
  155. }
  156. 
  157. void *av_mallocz(unsigned int size)
       ^
  158. {
  159.     void *ptr = av_malloc(size);

libavutil/mem.c:159:5: 
  157. void *av_mallocz(unsigned int size)
  158. {
  159.     void *ptr = av_malloc(size);
           ^
  160.     if (ptr)
  161.         memset(ptr, 0, size);

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.    linker will do it automatically. */
    63. 
    64. void *av_malloc(unsigned int size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(unsigned int size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:8: Taking true branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-16) )
               ^
    73.         return NULL;
    74. 

libavutil/mem.c:73:9: 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-16) )
    73.         return NULL;
                ^
    74. 
    75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
    115. #endif
    116.     return ptr;
    117. }
         ^
    118. 
    119. void *av_realloc(void *ptr, unsigned int size)

libavutil/mem.c:160:9: Taking false branch
  158. {
  159.     void *ptr = av_malloc(size);
  160.     if (ptr)
               ^
  161.         memset(ptr, 0, size);
  162.     return ptr;

libavutil/mem.c:162:5: 
  160.     if (ptr)
  161.         memset(ptr, 0, size);
  162.     return ptr;
           ^
  163. }
  164. 

libavutil/mem.c:163:1: return from a call to av_mallocz
  161.         memset(ptr, 0, size);
  162.     return ptr;
  163. }
       ^
  164. 
  165. char *av_strdup(const char *s)

libavformat/oggparsevorbis.c:184:5: 
182.     ptr = *buf = av_mallocz(len + len/255 + 64);
183. 
184.     ptr[0] = 2;
         ^
185.     offset = 1;
186.     offset += av_xiphlacing(&ptr[offset], priv->len[0]);

static unsigned int
fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,
                     uint8_t **buf)
{
    int i,offset, len;
    unsigned char *ptr;
    len = priv->len[0] + priv->len[1] + priv->len[2];
    ptr = *buf = av_mallocz(len + len/255 + 64);
    ptr[0] = 2;
    offset = 1;
    offset += av_xiphlacing(&ptr[offset], priv->len[0]);
    offset += av_xiphlacing(&ptr[offset], priv->len[1]);
    for (i = 0; i < 3; i++) {
        memcpy(&ptr[offset], priv->packet[i], priv->len[i]);
        offset += priv->len[i];
        av_freep(&priv->packet[i]);
    }
    *buf = av_realloc(*buf, offset + FF_INPUT_BUFFER_PADDING_SIZE);
    return offset;
}
['static unsigned int\nfixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,\n                     uint8_t **buf)\n{\n    int i,offset, len;\n    unsigned char *ptr;\n    len = priv->len[0] + priv->len[1] + priv->len[2];\n    ptr = *buf = av_mallocz(len + len/255 + 64);\n    ptr[0] = 2;\n    offset = 1;\n    offset += av_xiphlacing(&ptr[offset], priv->len[0]);\n    offset += av_xiphlacing(&ptr[offset], priv->len[1]);\n    for (i = 0; i < 3; i++) {\n        memcpy(&ptr[offset], priv->packet[i], priv->len[i]);\n        offset += priv->len[i];\n        av_freep(&priv->packet[i]);\n    }\n    *buf = av_realloc(*buf, offset + FF_INPUT_BUFFER_PADDING_SIZE);\n    return offset;\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 = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if 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 HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']