diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index a56ff99547..dec6995c46 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1795,8 +1795,9 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) } content[size] ='\0'; - ff_sdp_parse(s, content); + err = ff_sdp_parse(s, content); av_free(content); + if (err) goto fail; /* open each RTP stream */ for (i = 0; i < rt->nb_rtsp_streams; i++) { diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 55996e3631..f95f7c3851 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -136,7 +136,7 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) ret = ff_sdp_parse(s, (const char *)content); av_freep(&content); if (ret < 0) - return AVERROR_INVALIDDATA; + return ret; return 0; }