mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-22 07:09:16 +02:00
Fix a memory leak in g_ptr_array_remove_index_fast
We need to call the element_free_func even if we remove the last element. Bug #618866.
This commit is contained in:
parent
ea6470e31a
commit
5fffa39b6a
@ -1076,12 +1076,11 @@ g_ptr_array_remove_index_fast (GPtrArray *farray,
|
|||||||
|
|
||||||
result = array->pdata[index_];
|
result = array->pdata[index_];
|
||||||
|
|
||||||
if (index_ != array->len - 1)
|
|
||||||
{
|
|
||||||
if (array->element_free_func != NULL)
|
if (array->element_free_func != NULL)
|
||||||
array->element_free_func (array->pdata[index_]);
|
array->element_free_func (array->pdata[index_]);
|
||||||
|
|
||||||
|
if (index_ != array->len - 1)
|
||||||
array->pdata[index_] = array->pdata[array->len - 1];
|
array->pdata[index_] = array->pdata[array->len - 1];
|
||||||
}
|
|
||||||
|
|
||||||
array->len -= 1;
|
array->len -= 1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user