Skip to content

Commit ed4a1a0

Browse files
committed
mapi_lib: plug two memleaks in oxcmail_import near plain_to_html
f1. me_alloc<char> include/gromox/defs.h:104 f2. plain_to_html(char const*) lib/mail_func.cpp:1568 f3. oxcmail_import(char const*, char const*, MAIL const*, void* (*)(unsigned long), std::function<long (PROPNAME_ARRAY const*, PROPID_ARRAY*)>) lib/mapi/oxcmail.cpp:2922 f4. cu_rfc822_to_message(store_object*, unsigned int, BINARY*) exch/zcore/common_util.cpp:2009 f5. zs_rfc822tomessage(GUID, unsigned int, unsigned int, BINARY*) exch/zcore/zserver.cpp:4968 Fixes: gromox-0~666 Fixes: gromox-1.13-58-gdc4984e55
1 parent 2a2901a commit ed4a1a0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/mapi/oxcmail.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,14 +2916,13 @@ MESSAGE_CONTENT *oxcmail_import(const char *charset, const char *str_zone,
29162916
if (!pmsg->proplist.has(PR_HTML)) {
29172917
auto s = pmsg->proplist.get<const char>(PR_BODY);
29182918
if (s != nullptr) {
2919-
auto phtml_bin = static_cast<BINARY *>(alloc(sizeof(BINARY)));
2920-
if (phtml_bin == nullptr)
2919+
BINARY bv;
2920+
bv.pc = plain_to_html(s);
2921+
if (bv.pc == nullptr)
29212922
return NULL;
2922-
phtml_bin->pc = plain_to_html(s);
2923-
if (phtml_bin->pc == nullptr)
2924-
return NULL;
2925-
phtml_bin->cb = strlen(phtml_bin->pc);
2926-
pmsg->proplist.set(PR_HTML, phtml_bin);
2923+
bv.cb = strlen(bv.pc);
2924+
pmsg->proplist.set(PR_HTML, &bv);
2925+
free(bv.pc);
29272926
uint32_t tmp_int32 = CP_UTF8;
29282927
if (pmsg->proplist.set(PR_INTERNET_CPID, &tmp_int32) != 0)
29292928
return nullptr;

0 commit comments

Comments
 (0)