pool: fix deallocation of video pools.

The queue of free objects to used was deallocated with g_queue_free_full().
However, this convenience function shall only be used if the original queue
was allocated with g_queue_new(). This caused memory corruption, eventually
leading to a crash.

The correct solution is to pair the g_queue_init() with the corresponding
g_queue_clear(), while iterating over all free objects to deallocate them.
This commit is contained in:
Gwenole Beauchesne 2013-07-12 15:01:01 +02:00
parent 9b3ad4daad
commit ac75755105

View file

@ -70,7 +70,8 @@ void
gst_vaapi_video_pool_finalize(GstVaapiVideoPool *pool)
{
g_list_free_full(pool->used_objects, gst_vaapi_object_unref);
g_queue_free_full(&pool->free_objects, gst_vaapi_object_unref);
g_queue_foreach(&pool->free_objects, (GFunc)gst_vaapi_object_unref, NULL);
g_queue_clear(&pool->free_objects);
gst_vaapi_display_replace(&pool->display, NULL);
}