aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2025-01-12 08:09:34 -0700
committerRandy Palamar <randy@rnpnr.xyz>2025-01-12 08:09:34 -0700
commitfae3782e298bad30583e2e9b4888926732636de4 (patch)
treed38c35e8a4d8772075160e4e3fa9b30d3c974ba7
parentf2b2337a31c8e9e89085ed9d123d743e976ba85b (diff)
downloadvis-fae3782e298bad30583e2e9b4888926732636de4.tar.gz
vis-fae3782e298bad30583e2e9b4888926732636de4.tar.xz
sam: fix small oversight in cmd_filter
This was the only place where buffer_move was actaully doing something useful.
-rw-r--r--sam.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sam.c b/sam.c
index f1d57c5..e835367 100644
--- a/sam.c
+++ b/sam.c
@@ -1745,10 +1745,10 @@ static bool cmd_filter(Vis *vis, Win *win, Command *cmd, const char *argv[], Sel
if (vis->interrupted) {
vis_info_show(vis, "Command cancelled");
} else if (status == 0) {
- if (!sam_change(win, sel, range, bufout.data, bufout.len, 1)) {
- free(bufout.data);
- bufout.data = 0;
- }
+ char *data = bufout.data;
+ bufout.data = 0;
+ if (!sam_change(win, sel, range, data, bufout.len, 1))
+ free(data);
} else {
vis_info_show(vis, "Command failed %s", buffer_content0(&buferr));
}