This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 8d46d88f05e85de6a6741084393f1a755a92b43e Author: Marvin Scholz <[email protected]> AuthorDate: Thu Feb 19 20:27:41 2026 +0100 Commit: Marvin Scholz <[email protected]> CommitDate: Fri Feb 20 01:31:06 2026 +0100 avformat: rtspdec: fix leaks in rtsp_read_command_reply Reorder to avoid allocation if there is nothing to read and also solve a memory leak in that case. Also make sure to free the RTSPMessageHeader, which is not passed to the caller. --- libavformat/rtspdec.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 1fd50bf9be..2c6a7c41bc 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -674,17 +674,22 @@ static int rtsp_read_command_reply(AVFormatContext *s, enum AVFormatCommandID id if (!data_out) return AVERROR(EINVAL); - AVRTSPResponse *res = av_malloc(sizeof(*res)); - if (!res) - return AVERROR(ENOMEM); - + unsigned char *body; RTSPMessageHeader *reply; - int ret = ff_rtsp_read_reply_async_stored(s, &reply, &res->body); + int ret = ff_rtsp_read_reply_async_stored(s, &reply, &body); if (ret < 0) return ret; + AVRTSPResponse *res = av_malloc(sizeof(*res)); + if (!res) { + av_free(body); + av_free(reply); + return AVERROR(ENOMEM); + } + res->status_code = reply->status_code; res->body_len = reply->content_length; + res->body = body; res->reason = av_strdup(reply->reason); if (!res->reason) { @@ -694,6 +699,7 @@ static int rtsp_read_command_reply(AVFormatContext *s, enum AVFormatCommandID id return AVERROR(ENOMEM); } + av_free(reply); *data_out = res; return 0; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
