diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a0e0b9e1a5627b572cf391fe2e22780564315cad..160495b5f87aa64b4a369abf852186725187319b 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1296,10 +1296,9 @@ static int rtsp_read_play(AVFormatContext *s)
     return 0;
 }
 
-static int rtsp_setup_input_streams(AVFormatContext *s)
+static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
 {
     RTSPState *rt = s->priv_data;
-    RTSPMessageHeader reply1, *reply = &reply1;
     char cmd[1024];
     unsigned char *content = NULL;
     int ret;
@@ -1531,7 +1530,7 @@ redirect:
     }
 
     if (s->iformat)
-        err = rtsp_setup_input_streams(s);
+        err = rtsp_setup_input_streams(s, reply);
     else
         err = rtsp_setup_output_streams(s, host);
     if (err)