libavformat/rtsp.c:1795: error: Null Dereference
  pointer `content` last assigned on line 1789 could be null and is dereferenced at line 1795, column 5.

libavformat/rtsp.c:1779:1: start of procedure sdp_read_header()
1777. #define SDP_MAX_SIZE 8192
1778. 
1779. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
      ^
1780. {
1781.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:1781:5: 
1779. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
1780. {
1781.     RTSPState *rt = s->priv_data;
          ^
1782.     RTSPStream *rtsp_st;
1783.     int size, i, err;

libavformat/rtsp.c:1789:5: 
1787.     /* read the whole sdp file */
1788.     /* XXX: better loading */
1789.     content = av_malloc(SDP_MAX_SIZE);
          ^
1790.     size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
1791.     if (size <= 0) {

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 false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:83:9: Taking true branch
  81.     ((char*)ptr)[-1]= diff;
  82. #elif HAVE_POSIX_MEMALIGN
  83.     if (posix_memalign(&ptr,16,size))
              ^
  84.         ptr = NULL;
  85. #elif HAVE_MEMALIGN

libavutil/mem.c:84:9: 
  82. #elif HAVE_POSIX_MEMALIGN
  83.     if (posix_memalign(&ptr,16,size))
  84.         ptr = NULL;
              ^
  85. #elif HAVE_MEMALIGN
  86.     ptr = memalign(16,size);

libavutil/mem.c:116:5: 
  114.     ptr = malloc(size);
  115. #endif
  116.     return ptr;
           ^
  117. }
  118. 

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)

libavformat/rtsp.c:1790:5: Skipping get_buffer(): empty list of specs
1788.     /* XXX: better loading */
1789.     content = av_malloc(SDP_MAX_SIZE);
1790.     size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
          ^
1791.     if (size <= 0) {
1792.         av_free(content);

libavformat/rtsp.c:1791:9: Taking false branch
1789.     content = av_malloc(SDP_MAX_SIZE);
1790.     size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
1791.     if (size <= 0) {
              ^
1792.         av_free(content);
1793.         return AVERROR_INVALIDDATA;

libavformat/rtsp.c:1795:5: 
1793.         return AVERROR_INVALIDDATA;
1794.     }
1795.     content[size] ='\0';
          ^
1796. 
1797.     sdp_parse(s, content);

static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
    RTSPState *rt = s->priv_data;
    RTSPStream *rtsp_st;
    int size, i, err;
    char *content;
    char url[1024];
    content = av_malloc(SDP_MAX_SIZE);
    size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
    if (size <= 0) {
        av_free(content);
        return AVERROR_INVALIDDATA;
    }
    content[size] ='\0';
    sdp_parse(s, content);
    av_free(content);
    for (i = 0; i < rt->nb_rtsp_streams; i++) {
        rtsp_st = rt->rtsp_streams[i];
        snprintf(url, sizeof(url), "rtp://%s:%d?localport=%d&ttl=%d",
                 inet_ntoa(rtsp_st->sdp_ip),
                 rtsp_st->sdp_port,
                 rtsp_st->sdp_port,
                 rtsp_st->sdp_ttl);
        if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
            err = AVERROR_INVALIDDATA;
            goto fail;
        }
        if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
            goto fail;
    }
    return 0;
fail:
    rtsp_close_streams(rt);
    return err;
}
['static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)\n{\n    RTSPState *rt = s->priv_data;\n    RTSPStream *rtsp_st;\n    int size, i, err;\n    char *content;\n    char url[1024];\n    content = av_malloc(SDP_MAX_SIZE);\n    size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);\n    if (size <= 0) {\n        av_free(content);\n        return AVERROR_INVALIDDATA;\n    }\n    content[size] =\'\\0\';\n    sdp_parse(s, content);\n    av_free(content);\n    for (i = 0; i < rt->nb_rtsp_streams; i++) {\n        rtsp_st = rt->rtsp_streams[i];\n        snprintf(url, sizeof(url), "rtp://%s:%d?localport=%d&ttl=%d",\n                 inet_ntoa(rtsp_st->sdp_ip),\n                 rtsp_st->sdp_port,\n                 rtsp_st->sdp_port,\n                 rtsp_st->sdp_ttl);\n        if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {\n            err = AVERROR_INVALIDDATA;\n            goto fail;\n        }\n        if ((err = rtsp_open_transport_ctx(s, rtsp_st)))\n            goto fail;\n    }\n    return 0;\nfail:\n    rtsp_close_streams(rt);\n    return err;\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}']