@@ -489,7 +489,7 @@ DeleteElementFromCollection(
489489    )
490490{
491491    HRESULT hr = NOERROR;
492-     ULONG index;
492+     ULONG index =  0 ;
493493
494494    VARIANT varIndex;
495495    VariantInit ( &varIndex );
@@ -627,15 +627,13 @@ FindElementInCollection(
627627    VARIANT varKeyValue;
628628    VariantInit ( &varKeyValue );
629629
630-     DWORD   count;
631-     DWORD   i;
630+     DWORD   count =  0 ;
631+     DWORD   i =  0 ;
632632
633633    BSTR bstrKeyName = nullptr ;
634-     PFN_FIND_COMPARE_PROC compareProc;
635- 
636-     compareProc = (BehaviorFlags & FIND_ELEMENT_CASE_INSENSITIVE)
637-                       ? &FindCompareCaseInsensitive
638-                       : &FindCompareCaseSensitive;
634+     PFN_FIND_COMPARE_PROC compareProc = (BehaviorFlags & FIND_ELEMENT_CASE_INSENSITIVE)
635+                                       ? &FindCompareCaseInsensitive
636+                                       : &FindCompareCaseSensitive;
639637
640638    bstrKeyName = SysAllocString ( szKeyName );
641639    if ( !bstrKeyName )
@@ -761,8 +759,6 @@ GetLocationFromFile(
761759    CComPtr<IAppHostConfigLocationCollection>   pLocationCollection;
762760    CComPtr<IAppHostConfigLocation>             pLocation;
763761
764-     BSTR bstrLocationPath = nullptr ;
765- 
766762    *ppLocation = nullptr ;
767763    *pFound = FALSE ;
768764
@@ -773,21 +769,23 @@ GetLocationFromFile(
773769    if ( FAILED (hr) )
774770    {
775771        DBGERROR_HR (hr);
776-         goto  exit ;
772+         return  hr ;
777773    }
778774
779-     DWORD count;
780-     DWORD i;
775+     DWORD count =  0 ;
776+     DWORD i =  0 ;
781777    VARIANT varIndex;
782778    VariantInit ( &varIndex );
783779
784780    hr = pLocationCollection->get_Count ( &count );
785781    if ( FAILED (hr) )
786782    {
787783        DBGERROR_HR (hr);
788-         goto  exit ;
784+         return  hr ;
789785    }
790786
787+     BSTR bstrLocationPath = nullptr ;
788+ 
791789    for ( i = 0 ; i < count; i++ )
792790    {
793791        varIndex.vt  = VT_UI4;
@@ -841,8 +839,8 @@ GetSectionFromLocation(
841839
842840    CComPtr<IAppHostElement>    pSectionElement;
843841
844-     DWORD count;
845-     DWORD i;
842+     DWORD count =  0 ;
843+     DWORD i =  0 ;
846844
847845    VARIANT varIndex;
848846    VariantInit ( &varIndex );
@@ -1002,8 +1000,8 @@ ClearElementFromAllSites(
10021000    CComPtr<IAppHostElementCollection> pSitesCollection;
10031001    CComPtr<IAppHostElement> pSiteElement;
10041002    CComPtr<IAppHostChildElementCollection> pChildCollection;
1005-     ENUM_INDEX index;
1006-     BOOL found;
1003+     ENUM_INDEX index{} ;
1004+     BOOL found =  false ;
10071005
10081006    // 
10091007    //  Enumerate the sites, remove the specified elements.
@@ -1074,7 +1072,7 @@ ClearElementFromAllLocations(
10741072    CComPtr<IAppHostConfigLocationCollection> pLocationCollection;
10751073    CComPtr<IAppHostConfigLocation> pLocation;
10761074    CComPtr<IAppHostChildElementCollection> pChildCollection;
1077-     ENUM_INDEX index;
1075+     ENUM_INDEX index{} ;
10781076
10791077    // 
10801078    //  Enum the <location> tags, remove the specified elements.
@@ -1125,10 +1123,10 @@ ClearLocationElements(
11251123    IN      CONST WCHAR *               szElementName
11261124    )
11271125{
1128-     HRESULT hr;
1126+     HRESULT hr = S_OK ;
11291127    CComPtr<IAppHostElement> pElement;
1130-     ENUM_INDEX index;
1131-     BOOL matched;
1128+     ENUM_INDEX index{} ;
1129+     BOOL matched =  false ;
11321130
11331131    for  (hr = FindFirstLocationElement (pLocation, &index, &pElement) ;
11341132         SUCCEEDED (hr) ;
@@ -1199,10 +1197,10 @@ ClearChildElementsByName(
11991197    OUT     BOOL *                              pFound
12001198    )
12011199{
1202-     HRESULT hr;
1200+     HRESULT hr = S_OK ;
12031201    CComPtr<IAppHostElement> pElement;
1204-     ENUM_INDEX index;
1205-     BOOL matched;
1202+     ENUM_INDEX index{} ;
1203+     BOOL matched =  false ;
12061204
12071205    *pFound = FALSE ;
12081206
@@ -1253,7 +1251,7 @@ GetSitesCollection(
12531251    OUT     IAppHostElementCollection **        pSitesCollection
12541252    )
12551253{
1256-     HRESULT hr;
1254+     HRESULT hr = S_OK ;
12571255    CComPtr<IAppHostElement> pSitesElement;
12581256
12591257    BSTR bstrConfigPath = SysAllocString (szConfigPath);
@@ -1304,7 +1302,7 @@ GetLocationCollection(
13041302    OUT     IAppHostConfigLocationCollection ** pLocationCollection
13051303    )
13061304{
1307-     HRESULT hr;
1305+     HRESULT hr = S_OK ;
13081306    CComPtr<IAppHostConfigManager>      pConfigMgr;
13091307    CComPtr<IAppHostConfigFile>         pConfigFile;
13101308
0 commit comments