diff --git a/src/g_demo.c b/src/g_demo.c
index 22cd34ad59b389cb0162e2b73de9e699660e20ac..9adafae54d4da5b2ca8f9696d6952adcb623dced 100644
--- a/src/g_demo.c
+++ b/src/g_demo.c
@@ -2223,6 +2223,18 @@ void G_AddGhost(char *defdemoname)
 	Z_Free(pdemoname);
 }
 
+// Clean up all ghosts
+void G_FreeGhosts(void)
+{
+	while (ghosts)
+	{
+		demoghost *next = ghosts->next;
+		Z_Free(ghosts);
+		ghosts = next;
+	}
+	ghosts = NULL;
+}
+
 //
 // G_TimeDemo
 // NOTE: name is a full filename for external demos
@@ -2389,14 +2401,7 @@ boolean G_CheckDemoStatus(void)
 {
 	boolean saved;
 
-	while (ghosts)
-	{
-		demoghost *next = ghosts->next;
-		Z_Free(ghosts);
-		ghosts = next;
-	}
-	ghosts = NULL;
-
+	G_FreeGhosts();
 
 	// DO NOT end metal sonic demos here
 
diff --git a/src/g_demo.h b/src/g_demo.h
index 89be6e3435b3defc3c361d8375fda33f2182833d..df25042c48030402622a71a611c8a7f2a53649e7 100644
--- a/src/g_demo.h
+++ b/src/g_demo.h
@@ -75,6 +75,7 @@ void G_DeferedPlayDemo(const char *demo);
 void G_DoPlayDemo(char *defdemoname);
 void G_TimeDemo(const char *name);
 void G_AddGhost(char *defdemoname);
+void G_FreeGhosts(void);
 void G_DoPlayMetal(void);
 void G_DoneLevelLoad(void);
 void G_StopMetalDemo(void);
diff --git a/src/g_game.c b/src/g_game.c
index fb70e2995ad63bae54e53c7a4bbbd49e1cd19d9e..e22961b9addf5460038a7bc85508cf509c594a36 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -4490,7 +4490,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
 
 	if (demoplayback)
 		COM_BufAddText("stopdemo\n");
-	ghosts = NULL;
+	G_FreeGhosts(); // TODO: do we actually need to do this?
 
 	// this leave the actual game if needed
 	SV_StartSinglePlayerServer();