diff options
author | xaizek <xaizek@posteo.net> | 2024-05-09 19:08:26 +0300 |
---|---|---|
committer | xaizek <xaizek@posteo.net> | 2024-05-09 19:08:26 +0300 |
commit | c1cc08111402542ee920c20f517e3438475daaf0 (patch) | |
tree | 019a0a2d644f60ff63aa6d7be16701c78d753075 | |
parent | 1da93d1236c8652bfd40c8a2ff61068d8e15150e (diff) |
Improve body of cmdline.c:escape_cmd_for_pasting()
Variable declarations and when memory is freed.
-rw-r--r-- | src/modes/cmdline.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/modes/cmdline.c b/src/modes/cmdline.c index 819556bb4..718222e75 100644 --- a/src/modes/cmdline.c +++ b/src/modes/cmdline.c @@ -2365,21 +2365,17 @@ static char * escape_cmd_for_pasting(const char str[]) { wchar_t *const wide_input = vifm_wcsdup(input_stat.line); - char *mb_input; - char *escaped; - if(wide_input == NULL) { return NULL; } wide_input[input_stat.index] = L'\0'; - mb_input = to_multibyte(wide_input); - - escaped = cmds_insertion_escape(mb_input, strlen(mb_input), str); + char *mb_input = to_multibyte(wide_input); + free(wide_input); + char *escaped = cmds_insertion_escape(mb_input, strlen(mb_input), str); free(mb_input); - free(wide_input); return escaped; } |