eina_test_strbuf: Fix resource leak
authorChristopher Michael <cp.michael@samsung.com>
Thu, 2 May 2019 12:11:27 +0000 (14:11 +0200)
committerHermet Park <hermetpark@gmail.com>
Wed, 8 May 2019 04:30:08 +0000 (13:30 +0900)
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

Reviewers: raster, cedric, zmike, bu5hm4n, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8770

src/tests/eina/eina_test_strbuf.c

index a308374..67f3044 100644 (file)
@@ -630,7 +630,6 @@ EFL_START_TEST(eina_test_strbuf_strftime_test)
    fail_if(str == NULL || strcmp(str, cbuf) != 0);
    eina_strbuf_reset(buf);
 
-   buf = eina_strbuf_new();
    eina_strbuf_append(buf, "Hours: Minutes");
    eina_strbuf_prepend_strftime(buf, "%I ", info);
    eina_strbuf_insert_strftime(buf, "%M ", info, 10);