[PATCH] ole32: handle MSHLFLAGS_NORMAL correctly (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed May 6 10:08:04 CDT 2015


731556 Logically dead code

MSHLFLAGS_NORMAL is 0, so masking it directly will lead to dead code.

This enum MSHLFLAGS is pretty much misnamed, it seems part
enum of types and the MSHLFLAGS_NOPING flag.

It seems like:
------ types:
  MSHLFLAGS_NORMAL      = 0,
  MSHLFLAGS_TABLESTRONG = 1,
  MSHLFLAGS_TABLEWEAK   = 2,
------ additional flag:
  MSHLFLAGS_NOPING      = 4

Ciao, Marcus
---
 dlls/ole32/stubmanager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index fda4944..0769e52 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -102,7 +102,7 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s
     EnterCriticalSection(&m->lock);
     list_add_head(&m->ifstubs, &stub->entry);
     /* every normal marshal is counted so we don't allow more than we should */
-    if (flags & MSHLFLAGS_NORMAL) m->norm_refs++;
+    if ((flags & (MSHLFLAGS_TABLESTRONG|MSHLFLAGS_TABLEWEAK)) == MSHLFLAGS_NORMAL) m->norm_refs++;
     LeaveCriticalSection(&m->lock);
 
     TRACE("ifstub %p created with ipid %s\n", stub, debugstr_guid(&stub->ipid));
@@ -548,7 +548,7 @@ BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid)
     EnterCriticalSection(&m->lock);
 
     /* track normal marshals so we can enforce rules whilst in-process */
-    if (ifstub->flags & MSHLFLAGS_NORMAL)
+    if ((ifstub->flags & (MSHLFLAGS_TABLESTRONG|MSHLFLAGS_TABLEWEAK)) == MSHLFLAGS_NORMAL)
     {
         if (m->norm_refs)
             m->norm_refs--;
-- 
1.8.4.5




More information about the wine-patches mailing list