diff --git a/src/m_argv.c b/src/m_argv.c
index 859fc902611e69f0249332d13b095a25778bf8e4..5c5dc37cfb9cb70a958d1582b38ea8b5ee1ff191 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -2,7 +2,7 @@
 //-----------------------------------------------------------------------------
 // Copyright (C) 1993-1996 by id Software, Inc.
 // Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
 //
 // This program is free software distributed under the
 // terms of the GNU General Public License, version 2.
@@ -25,6 +25,10 @@ INT32 myargc;
 */
 char **myargv;
 
+/** \brief did we alloc myargv ourselves?
+*/
+boolean myargmalloc = false;
+
 /**	\brief founded the parm
 */
 static INT32 found;
@@ -176,6 +180,7 @@ void M_FindResponseFile(void)
 				free(file);
 				I_Error("Not enough memory to read response file");
 			}
+			myargmalloc = true; // mark as having been allocated by us
 			memset(myargv, 0, sizeof (char *) * MAXARGVS);
 			myargv[0] = firstargv;
 
@@ -198,17 +203,15 @@ void M_FindResponseFile(void)
 					k++;
 			} while (k < size);
 
-			free(file);
-
 			for (k = 0; k < pindex; k++)
 				myargv[indexinfile++] = moreargs[k];
 			myargc = indexinfile;
 
 			// display arguments
-			CONS_Printf(M_GetText("%d command-line args:\n"), myargc);
+			CONS_Printf(M_GetText("%d command-line args:\n"), myargc-1); // -1 so @ don't actually get counted for
 			for (k = 1; k < myargc; k++)
 				CONS_Printf("%s\n", myargv[k]);
 
 			break;
 		}
-}
+}
\ No newline at end of file
diff --git a/src/m_argv.h b/src/m_argv.h
index 46ef9a2cf5d81da5ddee474f004d17f6286d7f30..af346a2c16011168200d842dc27d47d61d4c2d78 100644
--- a/src/m_argv.h
+++ b/src/m_argv.h
@@ -19,6 +19,7 @@
 //
 extern INT32 myargc;
 extern char **myargv;
+extern boolean myargmalloc;
 
 // Returns the position of the given parameter in the arg list (0 if not found).
 INT32 M_CheckParm(const char *check);
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 5e0bc20e652222650cd7e484fb4aafd878020589..2b35ce8b8a044c824b6f825a117d5ae1cf9703dc 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -2139,6 +2139,8 @@ void I_Quit(void)
 		printf("\r");
 		ShowEndTxt();
 	}
+	if (myargmalloc)
+		free(myargv); // Deallocate allocated memory
 death:
 	W_Shutdown();
 	exit(0);
diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c
index ed0db653d1f51df07ae714199f5bd9f68c05de21..8729e5921d5b423945c47a58d2fb820a2f72d354 100644
--- a/src/sdl12/i_system.c
+++ b/src/sdl12/i_system.c
@@ -2301,6 +2301,8 @@ void I_Quit(void)
 		printf("\r");
 		ShowEndTxt();
 	}
+	if (myargmalloc)
+		free(myargv); // Deallocate allocated memory
 death:
 	W_Shutdown();
 #ifdef GP2X
diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c
index 316da61d4923d07c934915f88570d75bd98d31ef..77a21f7f38fd6d4c525391be3beaaaf57781885b 100644
--- a/src/win32/win_sys.c
+++ b/src/win32/win_sys.c
@@ -771,6 +771,8 @@ void I_Quit(void)
 		ShowEndTxt(co);
 	}
 	fflush(stderr);
+	if (myargmalloc)
+		free(myargv); // Deallocate allocated memory
 	W_Shutdown();
 	exit(0);
 }