mirror of
https://github.com/tmux/tmux.git
synced 2025-01-06 07:48:48 +00:00
Fix a few memory leaks.
This commit is contained in:
parent
3ed37a2079
commit
4a753dbefc
@ -426,7 +426,7 @@ command : assignment
|
||||
|
||||
arg = xcalloc(1, sizeof *arg);
|
||||
arg->type = CMD_PARSE_STRING;
|
||||
arg->string = xstrdup($2);
|
||||
arg->string = $2;
|
||||
TAILQ_INSERT_HEAD(&$$->arguments, arg, entry);
|
||||
}
|
||||
| optional_assignment TOKEN arguments
|
||||
@ -443,7 +443,7 @@ command : assignment
|
||||
|
||||
arg = xcalloc(1, sizeof *arg);
|
||||
arg->type = CMD_PARSE_STRING;
|
||||
arg->string = xstrdup($2);
|
||||
arg->string = $2;
|
||||
TAILQ_INSERT_HEAD(&$$->arguments, arg, entry);
|
||||
}
|
||||
|
||||
@ -543,13 +543,13 @@ argument : TOKEN
|
||||
{
|
||||
$$ = xcalloc(1, sizeof *$$);
|
||||
$$->type = CMD_PARSE_STRING;
|
||||
$$->string = xstrdup($1);
|
||||
$$->string = $1;
|
||||
}
|
||||
| EQUALS
|
||||
{
|
||||
$$ = xcalloc(1, sizeof *$$);
|
||||
$$->type = CMD_PARSE_STRING;
|
||||
$$->string = xstrdup($1);
|
||||
$$->string = $1;
|
||||
}
|
||||
| '{' argument_statements
|
||||
{
|
||||
@ -817,7 +817,6 @@ cmd_parse_build_command(struct cmd_parse_command *cmd,
|
||||
goto out;
|
||||
values[count].type = ARGS_COMMANDS;
|
||||
values[count].cmdlist = pr->cmdlist;
|
||||
values[count].cmdlist->references++;
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
|
@ -66,6 +66,7 @@ static void
|
||||
cmd_source_file_complete(struct client *c, struct cmd_source_file_data *cdata)
|
||||
{
|
||||
struct cmdq_item *new_item;
|
||||
u_int i;
|
||||
|
||||
if (cfg_finished) {
|
||||
if (cdata->retval == CMD_RETURN_ERROR &&
|
||||
@ -76,6 +77,8 @@ cmd_source_file_complete(struct client *c, struct cmd_source_file_data *cdata)
|
||||
cmdq_insert_after(cdata->after, new_item);
|
||||
}
|
||||
|
||||
for (i = 0; i < cdata->nfiles; i++)
|
||||
free(cdata->files[i]);
|
||||
free(cdata->files);
|
||||
free(cdata);
|
||||
}
|
||||
@ -177,6 +180,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "%s: %s", path, error);
|
||||
retval = CMD_RETURN_ERROR;
|
||||
}
|
||||
globfree(&g);
|
||||
free(pattern);
|
||||
continue;
|
||||
}
|
||||
@ -184,6 +188,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
|
||||
|
||||
for (j = 0; j < g.gl_pathc; j++)
|
||||
cmd_source_file_add(cdata, g.gl_pathv[j]);
|
||||
globfree(&g);
|
||||
}
|
||||
free(expanded);
|
||||
|
||||
|
@ -187,6 +187,7 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat,
|
||||
{
|
||||
struct key_table *table;
|
||||
struct key_binding *bd;
|
||||
char *s;
|
||||
|
||||
table = key_bindings_get_table(name, 1);
|
||||
|
||||
@ -216,8 +217,10 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat,
|
||||
bd->flags |= KEY_BINDING_REPEAT;
|
||||
bd->cmdlist = cmdlist;
|
||||
|
||||
s = cmd_list_print(bd->cmdlist, 0);
|
||||
log_debug("%s: %#llx %s = %s", __func__, bd->key,
|
||||
key_string_lookup_key(bd->key, 1), cmd_list_print(bd->cmdlist, 0));
|
||||
key_string_lookup_key(bd->key, 1), s);
|
||||
free(s);
|
||||
}
|
||||
|
||||
void
|
||||
|
1
spawn.c
1
spawn.c
@ -179,6 +179,7 @@ spawn_window(struct spawn_context *sc, char **cause)
|
||||
|
||||
/* Set the name of the new window. */
|
||||
if (~sc->flags & SPAWN_RESPAWN) {
|
||||
free(w->name);
|
||||
if (sc->name != NULL) {
|
||||
w->name = format_single(item, sc->name, c, s, NULL,
|
||||
NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user