Page MenuHomePhabricator

eina: prevent leak of Eina_Value internal allocation.

Authored by cedric on Sep 15 2019, 11:37 PM.



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.
Depends on D9942

Diff Detail

rEFL core/efl
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
cedric created this revision.Sep 15 2019, 11:37 PM
cedric requested review of this revision.Sep 15 2019, 11:37 PM
zmike accepted this revision.Sep 16 2019, 6:08 AM

I don't really see how this avoids a leak since eina_value_copy already calls eina_value_setup internally, but it does remove a redundancy.

This revision is now accepted and ready to land.Sep 16 2019, 6:08 AM

The double setup trigger a double allocation as it assume the value isn't allocated/initialized and has no way to know.

This revision was automatically updated to reflect the committed changes.