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

libavformat/rtsp.c:679:1: start of procedure rtsp_open_transport_ctx()
677. }
678. 
679. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
     ^
680. {
681.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:681:5: 
679. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
680. {
681.     RTSPState *rt = s->priv_data;
         ^
682.     AVStream *st = NULL;
683. 

libavformat/rtsp.c:682:5: 
680. {
681.     RTSPState *rt = s->priv_data;
682.     AVStream *st = NULL;
         ^
683. 
684.     /* open the RTP context */

libavformat/rtsp.c:685:9: Taking false branch
683. 
684.     /* open the RTP context */
685.     if (rtsp_st->stream_index >= 0)
             ^
686.         st = s->streams[rtsp_st->stream_index];
687.     if (!st)

libavformat/rtsp.c:687:10: Taking true branch
685.     if (rtsp_st->stream_index >= 0)
686.         st = s->streams[rtsp_st->stream_index];
687.     if (!st)
              ^
688.         s->ctx_flags |= AVFMTCTX_NOHEADER;
689. 

libavformat/rtsp.c:688:9: 
686.         st = s->streams[rtsp_st->stream_index];
687.     if (!st)
688.         s->ctx_flags |= AVFMTCTX_NOHEADER;
             ^
689. 
690.     if (s->oformat) {

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

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

libavformat/rtsp.c:695:9: 
693.         rtsp_st->rtp_handle = NULL;
694.     } else if (rt->transport == RTSP_TRANSPORT_RDT)
695.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
             ^
696.                                             rtsp_st->dynamic_protocol_context,
697.                                             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,
                                         &rtsp_st->rtp_payload_data);
    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                                         &rtsp_st->rtp_payload_data);\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}']