forked from enlightenment/efl
eina: prevent leak of Eina_Value internal allocation.
eina_value_copy assume the given Eina_Value as target is not initialized when it copy the source in it. In eina_value_reference_copy we were initialising before calling eina_value_copy which would then override and leak the internal pointer no fault of the users. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9943
This commit is contained in:
parent
93a382085b
commit
94e9363649
|
@ -327,8 +327,7 @@ eina_value_reference_copy(const Eina_Value *val)
|
|||
{
|
||||
Eina_Value v = EINA_VALUE_EMPTY;
|
||||
|
||||
if (!eina_value_setup(&v, eina_value_type_get(val)) ||
|
||||
!eina_value_copy(val, &v))
|
||||
if (!eina_value_copy(val, &v))
|
||||
{
|
||||
eina_value_setup(&v, EINA_VALUE_TYPE_ERROR);
|
||||
eina_value_set(&v, EINA_ERROR_VALUE_FAILED);
|
||||
|
|
Loading…
Reference in New Issue