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

libavformat/rtsp.c:2045:1: start of procedure sdp_read_header()
2043. }
2044. 
2045. static int sdp_read_header(AVFormatContext *s)
      ^
2046. {
2047.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:2047:5: 
2045. static int sdp_read_header(AVFormatContext *s)
2046. {
2047.     RTSPState *rt = s->priv_data;
          ^
2048.     RTSPStream *rtsp_st;
2049.     int size, i, err;

libavformat/rtsp.c:2053:10: 
2051.     char url[1024];
2052. 
2053.     if (!ff_network_init())
               ^
2054.         return AVERROR(EIO);
2055. 

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

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

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

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

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

libavformat/rtsp.c:2053:10: Taking false branch
2051.     char url[1024];
2052. 
2053.     if (!ff_network_init())
               ^
2054.         return AVERROR(EIO);
2055. 

libavformat/rtsp.c:2056:9: Taking false branch
2054.         return AVERROR(EIO);
2055. 
2056.     if (s->max_delay < 0) /* Not set by the caller */
              ^
2057.         s->max_delay = DEFAULT_REORDERING_DELAY;
2058.     if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)

libavformat/rtsp.c:2058:9: Taking true branch
2056.     if (s->max_delay < 0) /* Not set by the caller */
2057.         s->max_delay = DEFAULT_REORDERING_DELAY;
2058.     if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
              ^
2059.         rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
2060. 

libavformat/rtsp.c:2059:9: 
2057.         s->max_delay = DEFAULT_REORDERING_DELAY;
2058.     if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
2059.         rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
              ^
2060. 
2061.     /* read the whole sdp file */

libavformat/rtsp.c:2063:5: 
2061.     /* read the whole sdp file */
2062.     /* XXX: better loading */
2063.     content = av_malloc(SDP_MAX_SIZE);
          ^
2064.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2065.     if (size <= 0) {

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 false branch
  67. 
  68.     /* let's disallow possible ambiguous cases */
  69.     if (size > (INT_MAX - 32) || !size)
              ^
  70.         return NULL;
  71. 

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

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

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

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

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)

libavformat/rtsp.c:2064:5: Skipping avio_read(): empty list of specs
2062.     /* XXX: better loading */
2063.     content = av_malloc(SDP_MAX_SIZE);
2064.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
          ^
2065.     if (size <= 0) {
2066.         av_free(content);

libavformat/rtsp.c:2065:9: Taking false branch
2063.     content = av_malloc(SDP_MAX_SIZE);
2064.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2065.     if (size <= 0) {
              ^
2066.         av_free(content);
2067.         return AVERROR_INVALIDDATA;

libavformat/rtsp.c:2069:5: 
2067.         return AVERROR_INVALIDDATA;
2068.     }
2069.     content[size] ='\0';
          ^
2070. 
2071.     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", rtsp_st->sdp_port,
                        rtsp_st->sdp_ttl,
                        rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
            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", rtsp_st->sdp_port,\n                        rtsp_st->sdp_ttl,\n                        rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);\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}']