You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.3 KiB
123 lines
3.3 KiB
From 369627faddc1bba283c6afc4d473d7a495edb9a7 Mon Sep 17 00:00:00 2001
|
|
From: Josh Boyer <jwboyer@redhat.com>
|
|
Date: Fri, 7 Apr 2023 07:38:21 -0400
|
|
Subject: [PATCH 01/12] Fix memory leaks Backport of upstream commits:
|
|
4a753dbefc2e67c218cf41141eaa6afab00f774a
|
|
3c65475561b25073c3b7dcbb0b6498a0535ecd59
|
|
a9ac61469175e45c8ba58ae0360306aa06c0cd59
|
|
72d905f32c53ea1304b4b3206383502a23cfc0fd
|
|
|
|
---
|
|
cmd-display-menu.c | 6 +++++-
|
|
cmd-source-file.c | 4 +++-
|
|
format.c | 4 ++--
|
|
key-bindings.c | 5 ++++-
|
|
popup.c | 1 +
|
|
5 files changed, 15 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/cmd-display-menu.c b/cmd-display-menu.c
|
|
index de423e68..d61fedbb 100644
|
|
--- a/cmd-display-menu.c
|
|
+++ b/cmd-display-menu.c
|
|
@@ -248,6 +248,7 @@ cmd_display_menu_get_position(struct client *tc, struct cmdq_item *item,
|
|
log_debug("%s: -y: %s = %s = %u", __func__, yp, p, *py);
|
|
free(p);
|
|
|
|
+ format_free(ft);
|
|
return (1);
|
|
}
|
|
|
|
@@ -391,7 +392,10 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
|
|
else if (args_has(args, 'E'))
|
|
flags |= POPUP_CLOSEEXIT;
|
|
if (popup_display(flags, item, px, py, w, h, shellcmd, argc, argv, cwd,
|
|
- tc, s, NULL, NULL) != 0)
|
|
+ tc, s, NULL, NULL) != 0) {
|
|
+ free(cwd);
|
|
return (CMD_RETURN_NORMAL);
|
|
+ }
|
|
+ free(cwd);
|
|
return (CMD_RETURN_WAIT);
|
|
}
|
|
diff --git a/cmd-source-file.c b/cmd-source-file.c
|
|
index c1eeba58..296c31f9 100644
|
|
--- a/cmd-source-file.c
|
|
+++ b/cmd-source-file.c
|
|
@@ -176,15 +176,17 @@ 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;
|
|
}
|
|
- free(expand);
|
|
free(pattern);
|
|
|
|
for (j = 0; j < g.gl_pathc; j++)
|
|
cmd_source_file_add(cdata, g.gl_pathv[j]);
|
|
+ globfree(&g);
|
|
}
|
|
+ free(expand);
|
|
|
|
cdata->after = item;
|
|
cdata->retval = retval;
|
|
diff --git a/format.c b/format.c
|
|
index 512df009..673a6085 100644
|
|
--- a/format.c
|
|
+++ b/format.c
|
|
@@ -3382,12 +3382,12 @@ found:
|
|
}
|
|
if (modifiers & FORMAT_QUOTE_SHELL) {
|
|
saved = found;
|
|
- found = xstrdup(format_quote_shell(saved));
|
|
+ found = format_quote_shell(saved);
|
|
free(saved);
|
|
}
|
|
if (modifiers & FORMAT_QUOTE_STYLE) {
|
|
saved = found;
|
|
- found = xstrdup(format_quote_style(saved));
|
|
+ found = format_quote_style(saved);
|
|
free(saved);
|
|
}
|
|
return (found);
|
|
diff --git a/key-bindings.c b/key-bindings.c
|
|
index 467c7f93..4df0cddc 100644
|
|
--- a/key-bindings.c
|
|
+++ b/key-bindings.c
|
|
@@ -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
|
|
diff --git a/popup.c b/popup.c
|
|
index 509d182d..a98cc42a 100644
|
|
--- a/popup.c
|
|
+++ b/popup.c
|
|
@@ -142,6 +142,7 @@ popup_draw_cb(struct client *c, __unused struct screen_redraw_ctx *ctx0)
|
|
tty_draw_line(tty, &s, 0, i, pd->sx, px, py + i,
|
|
&grid_default_cell, NULL);
|
|
}
|
|
+ screen_free(&s);
|
|
c->overlay_check = popup_check_cb;
|
|
}
|
|
|
|
--
|
|
2.31.1
|
|
|