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

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

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

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

libavutil/mem.c:204:1: start of procedure av_mallocz()
  202. }
  203. 
  204. void *av_mallocz(size_t size)
       ^
  205. {
  206.     void *ptr = av_malloc(size);

libavutil/mem.c:206:5: 
  204. void *av_mallocz(size_t size)
  205. {
  206.     void *ptr = av_malloc(size);
           ^
  207.     if (ptr)
  208.         memset(ptr, 0, size);

libavutil/mem.c:61:1: start of procedure av_malloc()
    59.  * linker will do it automatically. */
    60. 
    61. void *av_malloc(size_t size)
        ^
    62. {
    63.     void *ptr = NULL;

libavutil/mem.c:63:5: 
    61. void *av_malloc(size_t size)
    62. {
    63.     void *ptr = NULL;
            ^
    64. #if CONFIG_MEMALIGN_HACK
    65.     long diff;

libavutil/mem.c:69:9: Taking true branch
    67. 
    68.     /* let's disallow possibly ambiguous cases */
    69.     if (size > (INT_MAX - 32) || !size)
                ^
    70.         return NULL;
    71. 

libavutil/mem.c:70:9: 
    68.     /* let's disallow possibly ambiguous cases */
    69.     if (size > (INT_MAX - 32) || !size)
    70.         return NULL;
                ^
    71. 
    72. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:114:1: return from a call to av_malloc
    112. #endif
    113.     return ptr;
    114. }
         ^
    115. 
    116. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:207:9: Taking false branch
  205. {
  206.     void *ptr = av_malloc(size);
  207.     if (ptr)
               ^
  208.         memset(ptr, 0, size);
  209.     return ptr;

libavutil/mem.c:209:5: 
  207.     if (ptr)
  208.         memset(ptr, 0, size);
  209.     return ptr;
           ^
  210. }
  211. 

libavutil/mem.c:210:1: return from a call to av_mallocz
  208.         memset(ptr, 0, size);
  209.     return ptr;
  210. }
       ^
  211. 
  212. char *av_strdup(const char *s)

libavformat/oggparsevorbis.c:185:5: 
183.     ptr = *buf = av_mallocz(len + len / 255 + 64);
184. 
185.     ptr[0]  = 2;
         ^
186.     offset  = 1;
187.     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, err;
    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]);
    }
    if ((err = av_reallocp(buf, offset + FF_INPUT_BUFFER_PADDING_SIZE)) < 0)
        return err;
    return offset;
}
['static unsigned int fixup_vorbis_headers(AVFormatContext *as,\n                                         struct oggvorbis_private *priv,\n                                         uint8_t **buf)\n{\n    int i, offset, len, err;\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    if ((err = av_reallocp(buf, offset + FF_INPUT_BUFFER_PADDING_SIZE)) < 0)\n        return err;\n    return offset;\n}', 'void *av_mallocz(size_t size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if (size > (INT_MAX - 32) || !size)\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size + 32);\n    if (!ptr)\n        return ptr;\n    diff              = ((-(long)ptr - 1) & 31) + 1;\n    ptr               = (char *)ptr + diff;\n    ((char *)ptr)[-1] = diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr, 32, size))\n        ptr = NULL;\n#elif HAVE_ALIGNED_MALLOC\n    ptr = _aligned_malloc(size, 32);\n#elif HAVE_MEMALIGN\n    ptr = memalign(32, size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']