Page MenuHomePhabricator

eina_test_strbuf: Fix resource leak
ClosedPublic

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

Details

Summary

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

@fix

Depends on D8769

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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.
src/tests/eina/eina_test_strbuf.c
633

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.