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

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

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

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

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

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

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

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

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

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

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