@@ -2774,12 +2774,19 @@ class SK_Steam_AchievementManager : public SK_AchievementManager
27742774 if ( achievement == nullptr ||
27752775 achievement->name_ .empty () )
27762776 {
2777- achievement = new
2777+ // If this fails, we're leaking memory.
2778+ SK_ReleaseAssert (achievement == nullptr );
2779+
2780+ achievement = new (std::nothrow)
27782781 Achievement (i,
27792782 stats->GetAchievementName (i),
27802783 stats
27812784 );
27822785
2786+ // Out of memory?!
2787+ if (achievement == nullptr )
2788+ continue ;
2789+
27832790 achievements.list [i] =
27842791 achievement;
27852792 achievements.string_map [achievement->name_ ] =
@@ -3781,6 +3788,9 @@ SK_Steam_GetLibraries (steam_library_t** ppLibraries)
37813788 dwSize =
37823789 GetFileSize (hLibFolders, &dwSizeHigh);
37833790
3791+ // A 4 GiB manifest file would be insane, so log it :)
3792+ SK_ReleaseAssert (dwSizeHigh == 0 && " Manifest Too Large!" );
3793+
37843794 std::unique_ptr <char []>
37853795 local_data;
37863796 char * data = nullptr ;
@@ -6430,12 +6440,14 @@ __stdcall
64306440SK_SteamOverlay_GoToURL ( const char * szURL,
64316441 bool bUseWindowsShellIfOverlayFails )
64326442{
6433- if ( steam_ctx.Utils () != nullptr &&
6434- steam_ctx.Utils ()->IsOverlayEnabled () )
6443+ auto utils = steam_ctx.Utils ();
6444+ if ( utils != nullptr &&
6445+ utils->IsOverlayEnabled () )
64356446 {
6436- if (steam_ctx.Friends () != nullptr )
6447+ auto friends = steam_ctx.Friends ();
6448+ if ( friends != nullptr )
64376449 {
6438- steam_ctx. Friends () ->ActivateGameOverlayToWebPage (szURL);
6450+ friends ->ActivateGameOverlayToWebPage (szURL);
64396451 return true ;
64406452 }
64416453 }
@@ -6454,12 +6466,14 @@ bool
64546466__stdcall
64556467SK_SteamOverlay_GoToFriendProfile (CSteamID friend_sid)
64566468{
6457- if ( steam_ctx.Utils () != nullptr &&
6458- steam_ctx.Utils ()->IsOverlayEnabled () )
6469+ auto utils = steam_ctx.Utils ();
6470+ if ( utils != nullptr &&
6471+ utils->IsOverlayEnabled () )
64596472 {
6460- if (steam_ctx.Friends () != nullptr )
6473+ auto friends = steam_ctx.Friends ();
6474+ if ( friends != nullptr )
64616475 {
6462- steam_ctx. Friends () ->ActivateGameOverlayToUser (
6476+ friends ->ActivateGameOverlayToUser (
64636477 " steamid" , friend_sid
64646478 );
64656479
@@ -6474,12 +6488,14 @@ bool
64746488__stdcall
64756489SK_SteamOverlay_GoToFriendAchievements (CSteamID friend_sid)
64766490{
6477- if ( steam_ctx.Utils () != nullptr &&
6478- steam_ctx.Utils ()->IsOverlayEnabled () )
6491+ auto utils = steam_ctx.Utils ();
6492+ if ( utils != nullptr &&
6493+ utils->IsOverlayEnabled () )
64796494 {
6480- if (steam_ctx.Friends () != nullptr )
6495+ auto friends = steam_ctx.Friends ();
6496+ if ( friends != nullptr )
64816497 {
6482- steam_ctx. Friends () ->ActivateGameOverlayToUser (
6498+ friends ->ActivateGameOverlayToUser (
64836499 " achievements" , friend_sid
64846500 );
64856501
@@ -6494,12 +6510,14 @@ bool
64946510__stdcall
64956511SK_SteamOverlay_GoToFriendStats (CSteamID friend_sid)
64966512{
6497- if ( steam_ctx.Utils () != nullptr &&
6498- steam_ctx.Utils ()->IsOverlayEnabled () )
6513+ auto utils = steam_ctx.Utils ();
6514+ if ( utils != nullptr &&
6515+ utils->IsOverlayEnabled () )
64996516 {
6500- if (steam_ctx.Friends () != nullptr )
6517+ auto friends = steam_ctx.Friends ();
6518+ if ( friends != nullptr )
65016519 {
6502- steam_ctx. Friends () ->ActivateGameOverlayToUser (
6520+ friends ->ActivateGameOverlayToUser (
65036521 " stats" , friend_sid
65046522 );
65056523
0 commit comments