Avoid triggering undefined behavior in the allocator when loading or saving ProjectileData[].

git-svn-id: https://svn.eduke32.com/eduke32@5111 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-29 02:40:15 +00:00
parent d49987d3cb
commit 9cf7da4366

View file

@ -1724,7 +1724,8 @@ static void sv_quoteload()
static void sv_preprojectilesave() static void sv_preprojectilesave()
{ {
ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles); if (ProjectileData != NULL || g_numProjectiles > 0)
ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles);
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
int onumprojectiles = g_numProjectiles; int onumprojectiles = g_numProjectiles;
#endif #endif
@ -1752,7 +1753,8 @@ static void sv_postprojectilesave()
static void sv_preprojectileload() static void sv_preprojectileload()
{ {
ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles); if (ProjectileData != NULL || g_numProjectiles > 0)
ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles);
} }
static void sv_postprojectileload() static void sv_postprojectileload()