libavformat/rtsp.c:578: error: Null Dereference
  pointer `st` last assigned on line 565 could be null and is dereferenced at line 578, column 56.

libavformat/rtsp.c:562:1: start of procedure rtsp_open_transport_ctx()
560. }
561. 
562. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
     ^
563. {
564.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:564:5: 
562. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
563. {
564.     RTSPState *rt = s->priv_data;
         ^
565.     AVStream *st = NULL;
566. 

libavformat/rtsp.c:565:5: 
563. {
564.     RTSPState *rt = s->priv_data;
565.     AVStream *st = NULL;
         ^
566. 
567.     /* open the RTP context */

libavformat/rtsp.c:568:9: Taking false branch
566. 
567.     /* open the RTP context */
568.     if (rtsp_st->stream_index >= 0)
             ^
569.         st = s->streams[rtsp_st->stream_index];
570.     if (!st)

libavformat/rtsp.c:570:10: Taking true branch
568.     if (rtsp_st->stream_index >= 0)
569.         st = s->streams[rtsp_st->stream_index];
570.     if (!st)
              ^
571.         s->ctx_flags |= AVFMTCTX_NOHEADER;
572. 

libavformat/rtsp.c:571:9: 
569.         st = s->streams[rtsp_st->stream_index];
570.     if (!st)
571.         s->ctx_flags |= AVFMTCTX_NOHEADER;
             ^
572. 
573.     if (s->oformat) {

libavformat/rtsp.c:573:9: Taking false branch
571.         s->ctx_flags |= AVFMTCTX_NOHEADER;
572. 
573.     if (s->oformat) {
             ^
574.         rtsp_st->transport_priv = rtsp_rtp_mux_open(s, st, rtsp_st->rtp_handle);
575.         /* Ownership of rtp_handle is passed to the rtp mux context */

libavformat/rtsp.c:577:16: Taking true branch
575.         /* Ownership of rtp_handle is passed to the rtp mux context */
576.         rtsp_st->rtp_handle = NULL;
577.     } else if (rt->transport == RTSP_TRANSPORT_RDT)
                    ^
578.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
579.                                             rtsp_st->dynamic_protocol_context,

libavformat/rtsp.c:578:9: 
576.         rtsp_st->rtp_handle = NULL;
577.     } else if (rt->transport == RTSP_TRANSPORT_RDT)
578.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
             ^
579.                                             rtsp_st->dynamic_protocol_context,
580.                                             rtsp_st->dynamic_handler);

static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
{
    RTSPState *rt = s->priv_data;
    AVStream *st = NULL;
    if (rtsp_st->stream_index >= 0)
        st = s->streams[rtsp_st->stream_index];
    if (!st)
        s->ctx_flags |= AVFMTCTX_NOHEADER;
    if (s->oformat) {
        rtsp_st->transport_priv = rtsp_rtp_mux_open(s, st, rtsp_st->rtp_handle);
        rtsp_st->rtp_handle = NULL;
    } else if (rt->transport == RTSP_TRANSPORT_RDT)
        rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
                                            rtsp_st->dynamic_protocol_context,
                                            rtsp_st->dynamic_handler);
    else
        rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
                                         rtsp_st->sdp_payload_type);
    if (!rtsp_st->transport_priv) {
         return AVERROR(ENOMEM);
    } else if (rt->transport != RTSP_TRANSPORT_RDT) {
        if (rtsp_st->dynamic_handler) {
            rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
                                           rtsp_st->dynamic_protocol_context,
                                           rtsp_st->dynamic_handler);
        }
    }
    return 0;
}
['static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)\n{\n    RTSPState *rt = s->priv_data;\n    AVStream *st = NULL;\n    if (rtsp_st->stream_index >= 0)\n        st = s->streams[rtsp_st->stream_index];\n    if (!st)\n        s->ctx_flags |= AVFMTCTX_NOHEADER;\n    if (s->oformat) {\n        rtsp_st->transport_priv = rtsp_rtp_mux_open(s, st, rtsp_st->rtp_handle);\n        rtsp_st->rtp_handle = NULL;\n    } else if (rt->transport == RTSP_TRANSPORT_RDT)\n        rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,\n                                            rtsp_st->dynamic_protocol_context,\n                                            rtsp_st->dynamic_handler);\n    else\n        rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,\n                                         rtsp_st->sdp_payload_type);\n    if (!rtsp_st->transport_priv) {\n         return AVERROR(ENOMEM);\n    } else if (rt->transport != RTSP_TRANSPORT_RDT) {\n        if (rtsp_st->dynamic_handler) {\n            rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,\n                                           rtsp_st->dynamic_protocol_context,\n                                           rtsp_st->dynamic_handler);\n        }\n    }\n    return 0;\n}']