Commit b0e058b5 authored by Francois Cartegnie's avatar Francois Cartegnie

httplive: leaks on playlist reload/merge (fix #14171)

parent b8f858f4
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment