From 94bafa5aafda52f795314bea7ceda3897bac2aad Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 22 Aug 2025 07:48:23 +0000 Subject: [PATCH] A couple of memory leaks from someone in GitHub issue 4590. --- cmd-capture-pane.c | 2 +- format.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 81e1f7f9..d42adf88 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -248,8 +248,8 @@ cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item) } file_print_buffer(c, buf, len); file_print(c, "\n"); - free(buf); } + free(buf); } else { bufname = NULL; if (args_has(args, 'b')) diff --git a/format.c b/format.c index 96e02d2c..91669608 100644 --- a/format.c +++ b/format.c @@ -4926,7 +4926,7 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen, struct window_pane *wp = ft->wp; const char *errstr, *copy, *cp, *cp2; const char *marker = NULL; - const char *time_format = NULL; + char *time_format = NULL; char *copy0, *condition, *found, *new; char *value, *left, *right; size_t valuelen; @@ -5461,6 +5461,7 @@ done: free(sub); format_free_modifiers(list, count); free(copy0); + free(time_format); return (0); fail: @@ -5469,6 +5470,7 @@ fail: free(sub); format_free_modifiers(list, count); free(copy0); + free(time_format); return (-1); }