summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-06-25 23:04:51 +0000
committerBram Moolenaar <Bram@vim.org>2005-06-25 23:04:51 +0000
commitf461c8e7f8ce2fd2ac3367680ec4c540f04ab259 (patch)
treebfacc7b1f4c7b6087026c9e8c39bb1f7b305d22f /src/main.c
parentea408854a8360b6925122ce7709b424ab3005209 (diff)
updated for version 7.0093v7.0093
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 2bed192816..1b64c34354 100644
--- a/src/main.c
+++ b/src/main.c
@@ -104,6 +104,7 @@ main
#endif
int n_commands = 0; /* no. of commands from + or -c */
char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c option */
+ char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */
#ifdef FEAT_PRECOMMANDS
int p_commands = 0; /* no. of commands from --cmd */
char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd option */
@@ -191,6 +192,8 @@ main
TIME_MSG("GUI prepared");
#endif
+ vim_memset(cmds_tofree, 0, sizeof(cmds_tofree));
+
/* Init the table of Normal mode commands. */
init_normal_cmds();
@@ -930,6 +933,7 @@ main
if (p == NULL)
mch_exit(2);
sprintf((char *)p, "so %s", a);
+ cmds_tofree[n_commands] = TRUE;
commands[n_commands++] = p;
}
else
@@ -2013,7 +2017,11 @@ scripterror:
current_SID = SID_CARG;
#endif
for (i = 0; i < n_commands; ++i)
+ {
do_cmdline_cmd(commands[i]);
+ if (cmds_tofree[i])
+ vim_free(commands[i]);
+ }
sourcing_name = NULL;
#ifdef FEAT_EVAL
current_SID = 0;