Copy-paste errors found by PVS-Studio. (#10450)
authorIlya <DieselMachine84@users.noreply.github.com>
Fri, 24 Mar 2017 15:48:02 +0000 (18:48 +0300)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 24 Mar 2017 15:48:02 +0000 (16:48 +0100)
I used PVS-Studio static analyzer to check this project. I would like to suggest a variant of the way to fix the copy-paste errors, detected with the help of V778 diagnostic. Description of the diagnostic: https://www.viva64.com/en/w/V778/

src/ildasm/dasm.cpp
src/jit/lclvars.cpp
src/vm/peimage.cpp

index 0cb5cc8..68cfa2a 100644 (file)
@@ -483,7 +483,7 @@ void Uninit()
     {
         SDELETE(g_szBuf_UnquotedProperName);
     }
-    if (g_szBuf_UnquotedProperName != NULL)
+    if (g_szBuf_ProperName != NULL)
     {
         SDELETE(g_szBuf_ProperName);
     }
index 319a64d..f0b9128 100644 (file)
@@ -2760,7 +2760,7 @@ int __cdecl Compiler::RefCntCmp(const void* op1, const void* op2)
         }
         if (varTypeIsGC(dsc2->TypeGet()))
         {
-            weight1 += BB_UNITY_WEIGHT / 2;
+            weight2 += BB_UNITY_WEIGHT / 2;
         }
 
         if (dsc2->lvRegister)
index 508f368..39b71ff 100644 (file)
@@ -808,7 +808,7 @@ void PEImage::EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
         m_pLayouts[IMAGE_MAPPED]->EnumMemoryRegions(flags);
     if (m_pLayouts[IMAGE_LOADED].IsValid() &&  m_pLayouts[IMAGE_LOADED]!=NULL)
         m_pLayouts[IMAGE_LOADED]->EnumMemoryRegions(flags);
-    if (m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION].IsValid() &&  m_pLayouts[IMAGE_LOADED]!=NULL)
+    if (m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION].IsValid() &&  m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION]!=NULL)
         m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION]->EnumMemoryRegions(flags);
 }