When av_dynarray_add failed, pls->init_sections will be freed,
which leads to leak of all entries of pls->init_sections.
---
libavformat/hls.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 67c9650e0b..e249810bce 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -463,7 +463,13 @@ static struct segment *get_init_section(struct playlist
*pls,
av_free(sec_ptr);
return NULL;
}
- dynarray_add(&pls->init_sections, &pls->n_init_sections, sec_ptr);
+ if (av_dynarray_add_nofree(&pls->init_sections,
+ &pls->n_init_sections,
+ sec_ptr) < 0) {
+ av_free(sec_ptr->url);
+ av_free(sec_ptr);
+ return NULL;
+ }
return sec_ptr;
}
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".