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

libavformat/rtsp.c:1960:1: start of procedure sdp_read_header()
1958. }
1959. 
1960. static int sdp_read_header(AVFormatContext *s)
      ^
1961. {
1962.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:1962:5: 
1960. static int sdp_read_header(AVFormatContext *s)
1961. {
1962.     RTSPState *rt = s->priv_data;
          ^
1963.     RTSPStream *rtsp_st;
1964.     int size, i, err;

libavformat/rtsp.c:1968:10: 
1966.     char url[1024];
1967. 
1968.     if (!ff_network_init())
               ^
1969.         return AVERROR(EIO);
1970. 

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

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

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

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

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

libavformat/rtsp.c:1968:10: Taking false branch
1966.     char url[1024];
1967. 
1968.     if (!ff_network_init())
               ^
1969.         return AVERROR(EIO);
1970. 

libavformat/rtsp.c:1971:9: Taking false branch
1969.         return AVERROR(EIO);
1970. 
1971.     if (s->max_delay < 0) /* Not set by the caller */
              ^
1972.         s->max_delay = DEFAULT_REORDERING_DELAY;
1973. 

libavformat/rtsp.c:1976:5: 
1974.     /* read the whole sdp file */
1975.     /* XXX: better loading */
1976.     content = av_malloc(SDP_MAX_SIZE);
          ^
1977.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
1978.     if (size <= 0) {

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

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

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

libavutil/mem.c:72:35: Taking false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if (size > (INT_MAX - 32) || !size)
                                        ^
  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, 32, size))
              ^
  84.         ptr = NULL;
  85. #elif HAVE_ALIGNED_MALLOC

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

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, size_t size)

libavformat/rtsp.c:1977:5: Skipping avio_read(): empty list of specs
1975.     /* XXX: better loading */
1976.     content = av_malloc(SDP_MAX_SIZE);
1977.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
          ^
1978.     if (size <= 0) {
1979.         av_free(content);

libavformat/rtsp.c:1978:9: Taking false branch
1976.     content = av_malloc(SDP_MAX_SIZE);
1977.     size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
1978.     if (size <= 0) {
              ^
1979.         av_free(content);
1980.         return AVERROR_INVALIDDATA;

libavformat/rtsp.c:1982:5: 
1980.         return AVERROR_INVALIDDATA;
1981.     }
1982.     content[size] ='\0';
          ^
1983. 
1984.     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;
    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];
        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    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        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        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}']