On Wed, Jun 25, 2025 at 11:38:31PM +0800, Lidong Yan wrote: > In sap_write_header(), ff_format_set_url() assign new allocated new_url > to contexts[i]->url but forgot to free it later. Add for loop to free > contexts[i]->url before av_free(context). > > To prevent from writing free-for-loop in every return point, replace > `return 0` with `ret = 0` so normal execution can fall through cleanup > code. Since normal code execution now go through code after fail label, > replace fail label with cleanup label. > > Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> > --- > libavformat/sapenc.c | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) > > diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c > index 87a834a8d8..810ba4adf6 100644 > --- a/libavformat/sapenc.c > +++ b/libavformat/sapenc.c > @@ -113,7 +113,7 @@ static int sap_write_header(AVFormatContext *s) > if (getaddrinfo(host, NULL, &hints, &ai)) { > av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host); > ret = AVERROR(EIO); > - goto fail; > + goto cleanup; please do the rename in a seperate patch so there are 2 patches, this makes the changes clearer thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates