Page MenuHomePhabricator

eina_test_strbuf: Fix resource leak

Authored by devilhorns on Apr 29 2019, 8:23 AM.



Coverity reports that we leak storage that 'buf' points to because we
are reassigning the variable, so lets free the previous strbuf so we
don't leak.

Fixes CID1400952


Depends on D8769

Diff Detail

rEFL core/efl
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
devilhorns created this revision.Apr 29 2019, 8:23 AM
devilhorns requested review of this revision.Apr 29 2019, 8:23 AM
segfaultxavi requested changes to this revision.May 2 2019, 3:43 AM
segfaultxavi added a subscriber: segfaultxavi.
segfaultxavi added inline comments.

Maybe instead of freeing buf and allocating it again in the next line, you can remove lines 633 and 635. The buffer has already been reset, so it is ready to continue working on it.

This revision now requires changes to proceed.May 2 2019, 3:43 AM
devilhorns updated this revision to Diff 21885.May 2 2019, 5:00 AM
devilhorns marked an inline comment as done.
devilhorns edited the summary of this revision. (Show Details)

Use eina_strbuf_reset

segfaultxavi accepted this revision.May 2 2019, 5:08 AM
This revision is now accepted and ready to land.May 2 2019, 5:08 AM
This revision was automatically updated to reflect the committed changes.