summaryrefslogtreecommitdiffstats
path: root/cmd-source-file.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-23 11:04:21 +0000
committernicm <nicm>2021-08-23 11:04:21 +0000
commit4a753dbefc2e67c218cf41141eaa6afab00f774a (patch)
tree6a52781c86c30894be0e2161c31154b3bdf953a0 /cmd-source-file.c
parent3ed37a207988bc6e96dc673ae4564a4efd682ea6 (diff)
Fix a few memory leaks.
Diffstat (limited to 'cmd-source-file.c')
-rw-r--r--cmd-source-file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd-source-file.c b/cmd-source-file.c
index fbe871ca..0bc02e05 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -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);