[vlc-commits] core: playlist: Fix leak on allocation failure
Romain Vimont
git at videolan.org
Tue Nov 20 10:43:31 CET 2018
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Fri Nov 16 11:43:50 2018 +0100| [d5ec9bd4457b2c082ba37aad33bd821713e2062a] | committer: Thomas Guillem
core: playlist: Fix leak on allocation failure
If vlc_vector_push() returns false, then we keep ownership of the item,
so we must release it.
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d5ec9bd4457b2c082ba37aad33bd821713e2062a
---
src/playlist/preparse.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/playlist/preparse.c b/src/playlist/preparse.c
index 89e5da177a..5231f0646a 100644
--- a/src/playlist/preparse.c
+++ b/src/playlist/preparse.c
@@ -38,7 +38,10 @@ vlc_playlist_CollectChildren(playlist_item_vector_t *dest,
input_item_node_t *child = node->pp_children[i];
vlc_playlist_item_t *item = vlc_playlist_item_New(child->p_item);
if (item)
- vlc_vector_push(dest, item);
+ {
+ if (!vlc_vector_push(dest, item))
+ vlc_playlist_item_Release(item);
+ }
vlc_playlist_CollectChildren(dest, child);
}
}
More information about the vlc-commits
mailing list