---
libavformat/hls.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavformat/hls.c b/libavformat/hls.c
index b5cdf158c6..3ed6007d0d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -556,7 +556,10 @@ static struct rendition *new_rendition(HLSContext *c,
struct rendition_info *inf
if (!rend)
return NULL;
- dynarray_add(&c->renditions, &c->n_renditions, rend);
+ if (av_dynarray_add_nofree(&c->renditions, &c->n_renditions, rend) < 0) {
+ av_free(rend);
+ return NULL;
+ }
rend->type = type;
strcpy(rend->group_id, info->group_id);
@@ -566,9 +569,14 @@ static struct rendition *new_rendition(HLSContext *c,
struct rendition_info *inf
/* add the playlist if this is an external rendition */
if (info->uri[0]) {
rend->playlist = new_playlist(c, info->uri, url_base);
- if (rend->playlist)
- dynarray_add(&rend->playlist->renditions,
- &rend->playlist->n_renditions, rend);
+ if (rend->playlist) {
+ if (av_dynarray_add_nofree(&rend->playlist->renditions,
+ &rend->playlist->n_renditions,
+ rend) < 0) {
+ /* Don't free rend since it's owned by c->renditions */
+ return NULL;
+ }
+ }
}
if (info->assoc_language[0]) {
--
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".