1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Explicitly check that m_str is NULL after an error return

Hopefully, this is enough of a hint to Coverity to squelch that
resource leak false positive as well ...
This commit is contained in:
Moritz Grimm 2017-09-25 21:01:55 +02:00
parent a896f2cc19
commit cb77b073de

View File

@ -68,15 +68,18 @@ START_TEST(test_stream)
ck_assert_int_ne(stream_set_metadata(s1, NULL, NULL), 0); ck_assert_int_ne(stream_set_metadata(s1, NULL, NULL), 0);
m_str = NULL; m_str = NULL;
ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0); ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0);
ck_assert_ptr_eq(m_str, NULL);
ck_assert_int_eq(mdata_parse_file(m, SRCDIR "/test15-title.ogg"), 0); ck_assert_int_eq(mdata_parse_file(m, SRCDIR "/test15-title.ogg"), 0);
ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0); ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0);
ck_assert_ptr_eq(m_str, NULL);
ck_assert_int_eq(mdata_parse_file(m, SRCDIR "/test16-nometa.ogg"), 0); ck_assert_int_eq(mdata_parse_file(m, SRCDIR "/test16-nometa.ogg"), 0);
ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0); ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0);
ck_assert_ptr_eq(m_str, NULL);
cfg_set_metadata_format_str("test", NULL); cfg_set_metadata_format_str("test", NULL);
ck_assert_int_eq(mdata_parse_file(m, SRCDIR "/test01-artist+album+title.ogg"), 0); ck_assert_int_eq(mdata_parse_file(m, SRCDIR "/test01-artist+album+title.ogg"), 0);
ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0); ck_assert_int_ne(stream_set_metadata(s1, m, &m_str), 0);
ck_assert_ptr_eq(m_str, NULL);
mdata_destroy(&m); mdata_destroy(&m);
} }