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

libavformat/rtsp.c:506:1: start of procedure rtsp_open_transport_ctx()
504. }
505. 
506. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
     ^
507. {
508.     RTSPState *rt = s->priv_data;

libavformat/rtsp.c:508:5: 
506. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
507. {
508.     RTSPState *rt = s->priv_data;
         ^
509.     AVStream *st = NULL;
510. 

libavformat/rtsp.c:509:5: 
507. {
508.     RTSPState *rt = s->priv_data;
509.     AVStream *st = NULL;
         ^
510. 
511.     /* open the RTP context */

libavformat/rtsp.c:512:9: Taking false branch
510. 
511.     /* open the RTP context */
512.     if (rtsp_st->stream_index >= 0)
             ^
513.         st = s->streams[rtsp_st->stream_index];
514.     if (!st)

libavformat/rtsp.c:514:10: Taking true branch
512.     if (rtsp_st->stream_index >= 0)
513.         st = s->streams[rtsp_st->stream_index];
514.     if (!st)
              ^
515.         s->ctx_flags |= AVFMTCTX_NOHEADER;
516. 

libavformat/rtsp.c:515:9: 
513.         st = s->streams[rtsp_st->stream_index];
514.     if (!st)
515.         s->ctx_flags |= AVFMTCTX_NOHEADER;
             ^
516. 
517.     if (s->oformat) {

libavformat/rtsp.c:517:9: Taking false branch
515.         s->ctx_flags |= AVFMTCTX_NOHEADER;
516. 
517.     if (s->oformat) {
             ^
518.         rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
519.                                       rtsp_st->rtp_handle,

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

libavformat/rtsp.c:524:9: 
522.         rtsp_st->rtp_handle = NULL;
523.     } else if (rt->transport == RTSP_TRANSPORT_RDT)
524.         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
             ^
525.                                             rtsp_st->dynamic_protocol_context,
526.                                             rtsp_st->dynamic_handler);
