Skip to content

Commit

Permalink
tests: resolve memleak in oxcmail_ie
Browse files Browse the repository at this point in the history
CID 1559998: (#1 of 1): Resource leak (RESOURCE_LEAK)
6. leaked_storage: Variable mc going out of scope leaks the storage it points to.
  • Loading branch information
jengelh committed Sep 7, 2024
1 parent a74309e commit ed04562
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/oxcmail_ie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

using namespace gromox;
using namespace gi_dump;
using mptr = std::unique_ptr<message_content, mc_delete>;

static alloc_context g_alloc_mgr;

Expand Down Expand Up @@ -77,7 +78,7 @@ static int select_parts_1()
appl_mixed_footer + appl_alt_footer;
MAIL m;
assert(m.load_from_str_move(data.data(), data.size()));
auto mc = oxcmail_import("us-ascii", "UTC", &m, g_alloc, ee_get_propids);
mptr mc(oxcmail_import("us-ascii", "UTC", &m, g_alloc, ee_get_propids));
assert(mc != nullptr);
auto atl = mc->children.pattachments;
assert(atl != nullptr);
Expand All @@ -104,7 +105,7 @@ static int select_parts_2()
appl_html1 + appl_zip + appl_mixed_footer + appl_alt_footer;
MAIL m;
assert(m.load_from_str_move(data.data(), data.size()));
auto mc = oxcmail_import("us-ascii", "UTC", &m, g_alloc, ee_get_propids);
mptr mc(oxcmail_import("us-ascii", "UTC", &m, g_alloc, ee_get_propids));
assert(mc != nullptr);
auto atl = mc->children.pattachments;
assert(atl != nullptr);
Expand Down Expand Up @@ -166,7 +167,7 @@ static int select_parts_3()

MAIL m;
assert(m.load_from_str_move(data, std::size(data)));
auto mc = oxcmail_import("us-ascii", "UTC", &m, g_alloc, ee_get_propids);
mptr mc(oxcmail_import("us-ascii", "UTC", &m, g_alloc, ee_get_propids));
assert(mc != nullptr);
auto atl = mc->children.pattachments;
assert(atl != nullptr);
Expand Down

0 comments on commit ed04562

Please sign in to comment.