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

libavformat/rtsp.c:515:1: start of procedure rtsp_open_transport_ctx()
513. }
514. 
515. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
     ^
516. {
517.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:517:5: 
515. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
516. {
517.     RTSPState *rt = s->priv_data;
         ^
518.     AVStream *st = NULL;
519. 

libavformat/rtsp.c:518:5: 
516. {
517.     RTSPState *rt = s->priv_data;
518.     AVStream *st = NULL;
         ^
519. 
520.     /* open the RTP context */

libavformat/rtsp.c:521:9: Taking false branch
519. 
520.     /* open the RTP context */
521.     if (rtsp_st->stream_index >= 0)
             ^
522.         st = s->streams[rtsp_st->stream_index];
523.     if (!st)

libavformat/rtsp.c:523:10: Taking true branch
521.     if (rtsp_st->stream_index >= 0)
522.         st = s->streams[rtsp_st->stream_index];
523.     if (!st)
              ^
524.         s->ctx_flags |= AVFMTCTX_NOHEADER;
525. 

libavformat/rtsp.c:524:9: 
522.         st = s->streams[rtsp_st->stream_index];
523.     if (!st)
524.         s->ctx_flags |= AVFMTCTX_NOHEADER;
             ^
525. 
526.     if (s->oformat && CONFIG_RTSP_MUXER) {

libavformat/rtsp.c:526:9: Taking false branch
524.         s->ctx_flags |= AVFMTCTX_NOHEADER;
525. 
526.     if (s->oformat && CONFIG_RTSP_MUXER) {
             ^
527.         rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
528.                                       rtsp_st->rtp_handle,

libavformat/rtsp.c:532:16: Taking true branch
530.         /* Ownership of rtp_handle is passed to the rtp mux context */
531.         rtsp_st->rtp_handle = NULL;
532.     } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
                    ^
533.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
534.                                             rtsp_st->dynamic_protocol_context,

libavformat/rtsp.c:532:55: Taking true branch
530.         /* Ownership of rtp_handle is passed to the rtp mux context */
531.         rtsp_st->rtp_handle = NULL;
532.     } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
                                                           ^
533.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
534.                                             rtsp_st->dynamic_protocol_context,

libavformat/rtsp.c:533:9: 
531.         rtsp_st->rtp_handle = NULL;
532.     } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
533.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
             ^
534.                                             rtsp_st->dynamic_protocol_context,
535.                                             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 && CONFIG_RTSP_MUXER) {
        rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
                                      rtsp_st->rtp_handle,
                                      RTSP_TCP_MAX_PACKET_SIZE);
        rtsp_st->rtp_handle = NULL;
    } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
        rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
                                            rtsp_st->dynamic_protocol_context,
                                            rtsp_st->dynamic_handler);
    else if (CONFIG_RTPDEC)
        rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
                                         rtsp_st->sdp_payload_type,
            (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)
            ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE);
    if (!rtsp_st->transport_priv) {
         return AVERROR(ENOMEM);
    } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) {
        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 && CONFIG_RTSP_MUXER) {\n        rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,\n                                      rtsp_st->rtp_handle,\n                                      RTSP_TCP_MAX_PACKET_SIZE);\n        rtsp_st->rtp_handle = NULL;\n    } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)\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 if (CONFIG_RTPDEC)\n        rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,\n                                         rtsp_st->sdp_payload_type,\n            (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)\n            ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE);\n    if (!rtsp_st->transport_priv) {\n         return AVERROR(ENOMEM);\n    } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) {\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}']