From c3bf75e8e026d6a992c7c5188f97eb89408a1001 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 11 Aug 2018 21:49:02 +0200 Subject: [PATCH 1/4] src/Mayaqua/Network.c: refactor code to eliminate coverity issue --- src/Mayaqua/Network.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c index 9b76facb..28172767 100644 --- a/src/Mayaqua/Network.c +++ b/src/Mayaqua/Network.c @@ -663,17 +663,15 @@ LIST *GetNicList() #ifdef OS_WIN32 o = Win32GetNicList(); -#endif // OS_WIN32 -#ifdef UNIX_LINUX -#endif // UNIX_LINUX - - if (o == NULL) + if (o != NULL) { - return NewListFast(NULL); + return o; } - return o; +#endif // OS_WIN32 + + return NewListFast(NULL); } #ifdef OS_WIN32 From 5d2b977b4bf069deba30aaa42c55b64278ccc829 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 11 Aug 2018 21:50:08 +0500 Subject: [PATCH 2/4] src/Mayaqua/FileIO.c: guard win32_drive_char with "#ifdef OS_WIN32" to avoid coverity warning --- src/Mayaqua/FileIO.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mayaqua/FileIO.c b/src/Mayaqua/FileIO.c index 9a07e590..9e089283 100644 --- a/src/Mayaqua/FileIO.c +++ b/src/Mayaqua/FileIO.c @@ -1912,7 +1912,9 @@ void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src) UNI_TOKEN_LIST *t; bool first_double_slash = false; bool first_single_slash = false; +#ifdef OS_WIN32 wchar_t win32_drive_char = 0; +#endif // OS_WIN32 bool is_full_path = false; UINT i; SK *sk; @@ -2036,6 +2038,7 @@ void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src) UniStrCat(tmp, sizeof(tmp), L"/"); } +#ifdef OS_WIN32 if (win32_drive_char != 0) { wchar_t d[2]; @@ -2044,6 +2047,7 @@ void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src) UniStrCat(tmp, sizeof(tmp), d); UniStrCat(tmp, sizeof(tmp), L":/"); } +#endif // OS_WIN32 for (i = 0;i < sk->num_item;i++) { From b8081e239a52e7d28866e89c2e6bf1c20e97c9c2 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 11 Aug 2018 21:53:24 +0500 Subject: [PATCH 3/4] src/Mayaqua/Cfg.c: "sub" is not assigned any value, no need to free it found by coverity --- src/Mayaqua/Cfg.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Mayaqua/Cfg.c b/src/Mayaqua/Cfg.c index 10f57578..a5fed440 100644 --- a/src/Mayaqua/Cfg.c +++ b/src/Mayaqua/Cfg.c @@ -1366,10 +1366,6 @@ void CfgAddItemText(BUF *b, ITEM *t, UINT depth) // Memory release Free(data); - if (sub != NULL) - { - Free(sub); - } } // Output the data line From dd2c1c0dcdfdb9dd9e9e70fda78c554d823c7bd3 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 11 Aug 2018 22:27:33 +0500 Subject: [PATCH 4/4] src/Cedar/DDNS.c: "interval" is unsigned, so MIN can only return 0 found by coverity --- src/Cedar/DDNS.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cedar/DDNS.c b/src/Cedar/DDNS.c index b1df1957..b8fa35ac 100644 --- a/src/Cedar/DDNS.c +++ b/src/Cedar/DDNS.c @@ -462,7 +462,7 @@ void DCThread(THREAD *thread, void *param) if (n == 1) { - interval = MIN(interval, 0); + interval = 0; } if (c->Halt)