From 41e07f08a4c65f3f4535d24cc5608797e7ffb6bb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 6 Jul 2001 20:04:05 +0000 Subject: [PATCH] oops, re-using freed memory is a nono :/ --- nq/source/console.c | 13 ++++--------- qw/source/console.c | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/nq/source/console.c b/nq/source/console.c index 07bb9f6d9..fb80f9587 100644 --- a/nq/source/console.c +++ b/nq/source/console.c @@ -592,16 +592,14 @@ Con_CompleteCommandLine (void) return; if (c + v + a == 1) { - char **l; if (c) - l = Cmd_CompleteBuildList(s); + list[0] = Cmd_CompleteBuildList(s); else if (v) - l = Cvar_CompleteBuildList(s); + list[0] = Cvar_CompleteBuildList(s); else - l = Cmd_CompleteAliasBuildList(s); - cmd = *l; + list[0] = Cmd_CompleteAliasBuildList(s); + cmd = *list[0]; cmd_len = strlen (cmd); - free (l); } else { if (c) cmd = *(list[0] = Cmd_CompleteBuildList(s)); @@ -635,19 +633,16 @@ Con_CompleteCommandLine (void) if (c) { Con_Printf("%i possible command%s\n", c, (c > 1) ? "s: " : ":"); Con_DisplayList(list[0], con_linewidth); - free(list[0]); } if (v) { Con_Printf("%i possible variable%s\n", v, (v > 1) ? "s: " : ":"); Con_DisplayList(list[1], con_linewidth); - free(list[1]); } if (a) { Con_Printf("%i possible aliases%s\n", a, (a > 1) ? "s: " : ":"); Con_DisplayList(list[2], con_linewidth); - free(list[2]); } } diff --git a/qw/source/console.c b/qw/source/console.c index 07bb9f6d9..fb80f9587 100644 --- a/qw/source/console.c +++ b/qw/source/console.c @@ -592,16 +592,14 @@ Con_CompleteCommandLine (void) return; if (c + v + a == 1) { - char **l; if (c) - l = Cmd_CompleteBuildList(s); + list[0] = Cmd_CompleteBuildList(s); else if (v) - l = Cvar_CompleteBuildList(s); + list[0] = Cvar_CompleteBuildList(s); else - l = Cmd_CompleteAliasBuildList(s); - cmd = *l; + list[0] = Cmd_CompleteAliasBuildList(s); + cmd = *list[0]; cmd_len = strlen (cmd); - free (l); } else { if (c) cmd = *(list[0] = Cmd_CompleteBuildList(s)); @@ -635,19 +633,16 @@ Con_CompleteCommandLine (void) if (c) { Con_Printf("%i possible command%s\n", c, (c > 1) ? "s: " : ":"); Con_DisplayList(list[0], con_linewidth); - free(list[0]); } if (v) { Con_Printf("%i possible variable%s\n", v, (v > 1) ? "s: " : ":"); Con_DisplayList(list[1], con_linewidth); - free(list[1]); } if (a) { Con_Printf("%i possible aliases%s\n", a, (a > 1) ? "s: " : ":"); Con_DisplayList(list[2], con_linewidth); - free(list[2]); } }