Skip to content

Commit 526a91d

Browse files
committed
fix: fix defects according to Coverity Scan
1 parent c8c64ff commit 526a91d

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

RimeWithWeasel/RimeWithWeasel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ bool RimeWithWeaselHandler::_Respond(UINT session_id, EatLine eat)
433433
RimeFreeCommit(&commit);
434434
}
435435

436-
bool is_composing;
436+
bool is_composing = false;
437437
RIME_STRUCT(RimeStatus, status);
438438
if (RimeGetStatus(session_id, &status))
439439
{

WeaselDeployer/Configurator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ int Configurator::SyncUserData() {
202202
if (!rime->sync_user_data())
203203
{
204204
LOG(ERROR) << "Error synching user data.";
205+
CloseHandle(hMutex);
205206
return 1;
206207
}
207208
rime->join_maintenance_thread();

WeaselDeployer/SwitcherSettingsDialog.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ LRESULT SwitcherSettingsDialog::OnOK(WORD, WORD code, HWND, BOOL&) {
109109
}
110110
}
111111
if (count == 0) {
112-
MessageBox(L"至少要選用一項吧。", L"小狼毫不是這般用法", MB_OK | MB_ICONEXCLAMATION);
112+
MessageBox(_T("至少要選用一項吧。"), _T("小狼毫不是這般用法"), MB_OK | MB_ICONEXCLAMATION);
113+
delete selection;
113114
return 0;
114115
}
115116
api_->select_schemas(settings_, selection, count);
117+
delete selection;
116118
}
117119
EndDialog(code);
118120
return 0;

WeaselServer/WeaselService.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ WeaselService::WeaselService(
4646

4747
WeaselService::~WeaselService()
4848
{
49+
if (_stoppedEvent != NULL)
50+
{
51+
CloseHandle(_stoppedEvent);
52+
}
4953
}
5054

5155
BOOL WeaselService::Run(WeaselService &serv)

WeaselSetup/imesetup.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,14 @@ int register_ime(const wpath& ime_path, bool register_ime, bool is_wow64, bool h
162162
DWORD len = sizeof(imeFile);
163163
DWORD type = 0;
164164
ret = RegQueryValueEx(hSubKey, L"Ime File", NULL, &type, (LPBYTE)imeFile, &len);
165-
RegCloseKey(hSubKey);
166-
if (_wcsicmp(imeFile, L"weasel.ime") == 0)
165+
if (ret = ERROR_SUCCESS)
167166
{
168-
hKL = (HKL)k; // already there
167+
if (_wcsicmp(imeFile, L"weasel.ime") == 0)
168+
{
169+
hKL = (HKL)k; // already there
170+
}
169171
}
172+
RegCloseKey(hSubKey);
170173
}
171174
else
172175
{

include/WeaselCommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace weasel
2929

3030
struct TextAttribute
3131
{
32-
TextAttribute() {}
32+
TextAttribute() : type(NONE) {}
3333
TextAttribute(int _start, int _end, TextAttributeType _type) : range(_start, _end), type(_type) {}
3434
TextRange range;
3535
TextAttributeType type;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy