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

libavformat/rtsp.c:2161:1: start of procedure sdp_read_header()
2159. }
2160. 
2161. static int sdp_read_header(AVFormatContext *s)
      ^
2162. {
2163.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:2163:5: 
2161. static int sdp_read_header(AVFormatContext *s)
2162. {
2163.     RTSPState *rt = s->priv_data;
          ^
2164.     RTSPStream *rtsp_st;
2165.     int size, i, err;

libavformat/rtsp.c:2169:10: 
2167.     char url[1024];
2168. 
2169.     if (!ff_network_init())
               ^
2170.         return AVERROR(EIO);
2171. 

libavformat/network.c:123:1: start of procedure ff_network_init()
  121. int ff_network_inited_globally;
  122. 
  123. int ff_network_init(void)
       ^
  124. {
  125. #if HAVE_WINSOCK2_H

libavformat/network.c:129:10: Taking true branch
  127. #endif
  128. 
  129.     if (!ff_network_inited_globally)
                ^
  130.         av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
  131.                                      "network initialization. Please use "

libavformat/network.c:130:9: Skipping av_log(): empty list of specs
  128. 
  129.     if (!ff_network_inited_globally)
  130.         av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
               ^
  131.                                      "network initialization. Please use "
  132.                                      "avformat_network_init(), this will "

libavformat/network.c:138:5: 
  136.         return 0;
  137. #endif
  138.     return 1;
           ^
  139. }
  140. 

libavformat/network.c:139:1: return from a call to ff_network_init
  137. #endif
  138.     return 1;
  139. }
       ^
  140. 
  141. int ff_network_wait_fd(int fd, int write)

libavformat/rtsp.c:2169:10: Taking false branch
2167.     char url[1024];
2168. 
2169.     if (!ff_network_init())
               ^
2170.         return AVERROR(EIO);
2171. 

libavformat/rtsp.c:2172:9: Taking false branch
2170.         return AVERROR(EIO);
2171. 
2172.     if (s->max_delay < 0) /* Not set by the caller */
              ^
2173.         s->max_delay = DEFAULT_REORDERING_DELAY;
2174.     if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)

libavformat/rtsp.c:2174:9: Taking true branch
2172.     if (s->max_delay < 0) /* Not set by the caller */
2173.         s->max_delay = DEFAULT_REORDERING_DELAY;
2174.     if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
              ^
2175.         rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
2176. 

libavformat/rtsp.c:2175:9: 
2173.         s->max_delay = DEFAULT_REORDERING_DELAY;
2174.     if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
2175.         rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
              ^
2176. 
2177.     /* read the whole sdp file */

libavformat/rtsp.c:2179:5: 
2177.     /* read the whole sdp file */
2178.     /* XXX: better loading */
2179.     content = av_malloc(SDP_MAX_SIZE);
          ^
2180.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2181.     if (size <= 0) {

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

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

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

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

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

libavutil/mem.c:82:9: 
  80. #elif HAVE_POSIX_MEMALIGN
  81.     if (posix_memalign(&ptr, 32, size))
  82.         ptr = NULL;
              ^
  83. #elif HAVE_ALIGNED_MALLOC
  84.     ptr = _aligned_malloc(size, 32);

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

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

libavformat/rtsp.c:2180:5: Skipping avio_read(): empty list of specs
2178.     /* XXX: better loading */
2179.     content = av_malloc(SDP_MAX_SIZE);
2180.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
          ^
2181.     if (size <= 0) {
2182.         av_free(content);

libavformat/rtsp.c:2181:9: Taking false branch
2179.     content = av_malloc(SDP_MAX_SIZE);
2180.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2181.     if (size <= 0) {
              ^
2182.         av_free(content);
2183.         return AVERROR_INVALIDDATA;

libavformat/rtsp.c:2185:5: 
2183.         return AVERROR_INVALIDDATA;
2184.     }
2185.     content[size] ='\0';
          ^
2186. 
2187.     err = ff_sdp_parse(s, content);

static int sdp_read_header(AVFormatContext *s)
{
    RTSPState *rt = s->priv_data;
    RTSPStream *rtsp_st;
    int size, i, err;
    char *content;
    char url[1024];
    if (!ff_network_init())
        return AVERROR(EIO);
    if (s->max_delay < 0)
        s->max_delay = DEFAULT_REORDERING_DELAY;
    if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
        rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
    content = av_malloc(SDP_MAX_SIZE);
    size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
    if (size <= 0) {
        av_free(content);
        return AVERROR_INVALIDDATA;
    }
    content[size] ='\0';
    err = ff_sdp_parse(s, content);
    av_free(content);
    if (err) goto fail;
    for (i = 0; i < rt->nb_rtsp_streams; i++) {
        char namebuf[50];
        rtsp_st = rt->rtsp_streams[i];
        if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
            getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
                        namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
            ff_url_join(url, sizeof(url), "rtp", NULL,
                        namebuf, rtsp_st->sdp_port,
                        "?localport=%d&ttl=%d&connect=%d&write_to_source=%d",
                        rtsp_st->sdp_port, rtsp_st->sdp_ttl,
                        rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0,
                        rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0);
            append_source_addrs(url, sizeof(url), "sources",
                                rtsp_st->nb_include_source_addrs,
                                rtsp_st->include_source_addrs);
            append_source_addrs(url, sizeof(url), "block",
                                rtsp_st->nb_exclude_source_addrs,
                                rtsp_st->exclude_source_addrs);
            if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
                           &s->interrupt_callback, NULL) < 0) {
                err = AVERROR_INVALIDDATA;
                goto fail;
            }
        }
        if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
            goto fail;
    }
    return 0;
fail:
    ff_rtsp_close_streams(s);
    ff_network_close();
    return err;
}
['static int sdp_read_header(AVFormatContext *s)\n{\n    RTSPState *rt = s->priv_data;\n    RTSPStream *rtsp_st;\n    int size, i, err;\n    char *content;\n    char url[1024];\n    if (!ff_network_init())\n        return AVERROR(EIO);\n    if (s->max_delay < 0)\n        s->max_delay = DEFAULT_REORDERING_DELAY;\n    if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)\n        rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;\n    content = av_malloc(SDP_MAX_SIZE);\n    size = avio_read(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    err = ff_sdp_parse(s, content);\n    av_free(content);\n    if (err) goto fail;\n    for (i = 0; i < rt->nb_rtsp_streams; i++) {\n        char namebuf[50];\n        rtsp_st = rt->rtsp_streams[i];\n        if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {\n            getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),\n                        namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);\n            ff_url_join(url, sizeof(url), "rtp", NULL,\n                        namebuf, rtsp_st->sdp_port,\n                        "?localport=%d&ttl=%d&connect=%d&write_to_source=%d",\n                        rtsp_st->sdp_port, rtsp_st->sdp_ttl,\n                        rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0,\n                        rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0);\n            append_source_addrs(url, sizeof(url), "sources",\n                                rtsp_st->nb_include_source_addrs,\n                                rtsp_st->include_source_addrs);\n            append_source_addrs(url, sizeof(url), "block",\n                                rtsp_st->nb_exclude_source_addrs,\n                                rtsp_st->exclude_source_addrs);\n            if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,\n                           &s->interrupt_callback, NULL) < 0) {\n                err = AVERROR_INVALIDDATA;\n                goto fail;\n            }\n        }\n        if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))\n            goto fail;\n    }\n    return 0;\nfail:\n    ff_rtsp_close_streams(s);\n    ff_network_close();\n    return err;\n}', 'int ff_network_init(void)\n{\n#if HAVE_WINSOCK2_H\n    WSADATA wsaData;\n#endif\n    if (!ff_network_inited_globally)\n        av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "\n                                     "network initialization. Please use "\n                                     "avformat_network_init(), this will "\n                                     "become mandatory later.\\n");\n#if HAVE_WINSOCK2_H\n    if (WSAStartup(MAKEWORD(1,1), &wsaData))\n        return 0;\n#endif\n    return 1;\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}']