[vlc-commits] httplive: leaks on playlist reload/merge (fix #14171)
Francois Cartegnie
git at videolan.org
Wed Mar 18 13:03:19 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 18 12:56:15 2015 +0100| [b0e058b561b61404f992433964f82f9646c4863a] | committer: Francois Cartegnie
httplive: leaks on playlist reload/merge (fix #14171)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b0e058b561b61404f992433964f82f9646c4863a
---
modules/stream_filter/httplive.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index fa4201b..24b44c4 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1387,10 +1387,7 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
{
segment_t *p = segment_GetSegment(hls_new, n);
if (p == NULL)
- {
- vlc_mutex_unlock(&hls_old->lock);
- return VLC_EGENERIC;
- }
+ continue;
segment_t *segment = segment_Find(hls_old, p->sequence);
if (segment)
@@ -1432,8 +1429,8 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
}
free(segment->psz_key_path);
segment->psz_key_path = p->psz_key_path ? strdup(p->psz_key_path) : NULL;
- segment_Free(p);
}
+ segment_Free(p);
vlc_mutex_unlock(&segment->lock);
}
else
@@ -1442,7 +1439,8 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
segment_t *l = segment_GetSegment(hls_old, last);
if (l == NULL) {
vlc_mutex_unlock(&hls_old->lock);
- return VLC_EGENERIC;
+ segment_Free(p);
+ continue;
}
if ((l->sequence + 1) != p->sequence)
@@ -1465,8 +1463,9 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
hls_old->duration = (hls_new->duration == -1) ? hls_old->duration : hls_new->duration;
hls_old->b_cache = hls_new->b_cache;
vlc_mutex_unlock(&hls_old->lock);
- return VLC_SUCCESS;
+ vlc_array_clear(hls_new->segments);
+ return VLC_SUCCESS;
}
static int hls_ReloadPlaylist(stream_t *s)
@@ -1514,10 +1513,12 @@ static int hls_ReloadPlaylist(stream_t *s)
// New segment available - signal download thread
stream_appended = true;
+ continue;
}
else if (hls_UpdatePlaylist(s, hls_new, hls_old, &stream_appended) != VLC_SUCCESS)
msg_Warn(s, "failed updating HLS stream (id=%d, bandwidth=%"PRIu64")",
hls_new->id, hls_new->bandwidth);
+ hls_Free(hls_new);
}
vlc_array_destroy(hls_streams);
More information about the vlc-commits
mailing list