@@ -957,10 +957,10 @@ CreateWindowStationAndDesktops(
957957 SECURITY_ATTRIBUTES ApplicationDesktopSecurity ;
958958 SECURITY_ATTRIBUTES WinlogonDesktopSecurity ;
959959 SECURITY_ATTRIBUTES ScreenSaverDesktopSecurity ;
960- PSECURITY_DESCRIPTOR WlWinstaSecurityDescriptor ;
961- PSECURITY_DESCRIPTOR WlApplicationDesktopSecurityDescriptor ;
962- PSECURITY_DESCRIPTOR WlWinlogonDesktopSecurityDescriptor ;
963- PSECURITY_DESCRIPTOR WlScreenSaverDesktopSecurityDescriptor ;
960+ PSECURITY_DESCRIPTOR WlWinstaSecurityDescriptor = NULL ;
961+ PSECURITY_DESCRIPTOR WlApplicationDesktopSecurityDescriptor = NULL ;
962+ PSECURITY_DESCRIPTOR WlWinlogonDesktopSecurityDescriptor = NULL ;
963+ PSECURITY_DESCRIPTOR WlScreenSaverDesktopSecurityDescriptor = NULL ;
964964 BOOL ret = FALSE;
965965
966966 if (!CreateWinstaSecurity (& WlWinstaSecurityDescriptor ))
@@ -1110,23 +1110,17 @@ CreateWindowStationAndDesktops(
11101110 CloseWindowStation (Session -> InteractiveWindowStation );
11111111 Session -> InteractiveWindowStation = NULL ;
11121112 }
1113- if (WlWinstaSecurityDescriptor )
1114- {
1115- RtlFreeHeap (RtlGetProcessHeap (), 0 , WlWinstaSecurityDescriptor );
1116- }
1117- if (WlApplicationDesktopSecurityDescriptor )
1118- {
1119- RtlFreeHeap (RtlGetProcessHeap (), 0 , WlApplicationDesktopSecurityDescriptor );
1120- }
1121- if (WlWinlogonDesktopSecurityDescriptor )
1122- {
1123- RtlFreeHeap (RtlGetProcessHeap (), 0 , WlWinlogonDesktopSecurityDescriptor );
1124- }
1125- if (WlScreenSaverDesktopSecurityDescriptor )
1126- {
1127- RtlFreeHeap (RtlGetProcessHeap (), 0 , WlScreenSaverDesktopSecurityDescriptor );
1128- }
11291113 }
11301114
1115+ /* Free security descriptors regardless of success or failure */
1116+ if (WlWinstaSecurityDescriptor )
1117+ RtlFreeHeap (RtlGetProcessHeap (), 0 , WlWinstaSecurityDescriptor );
1118+ if (WlApplicationDesktopSecurityDescriptor )
1119+ RtlFreeHeap (RtlGetProcessHeap (), 0 , WlApplicationDesktopSecurityDescriptor );
1120+ if (WlWinlogonDesktopSecurityDescriptor )
1121+ RtlFreeHeap (RtlGetProcessHeap (), 0 , WlWinlogonDesktopSecurityDescriptor );
1122+ if (WlScreenSaverDesktopSecurityDescriptor )
1123+ RtlFreeHeap (RtlGetProcessHeap (), 0 , WlScreenSaverDesktopSecurityDescriptor );
1124+
11311125 return ret ;
11321126}
0 commit comments