aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/shell.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-04-12 11:37:22 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-04-13 08:22:44 -0300
commit34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b (patch)
tree3342c6d4a1cc54bbadb6018725410117885b3517 /src/nvim/os/shell.c
parentba10e311bddab18e38b1b706e232f804c2da9174 (diff)
downloadrneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.tar.gz
rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.tar.bz2
rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.zip
memory: Add `free` wrapper and refactor project to use it
We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
Diffstat (limited to 'src/nvim/os/shell.c')
-rw-r--r--src/nvim/os/shell.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 6fcb62a5f3..4f5928ba8a 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -80,11 +80,11 @@ void shell_free_argv(char **argv)
while (*p != NULL) {
// Free each argument
- free(*p);
+ xfree(*p);
p++;
}
- free(argv);
+ xfree(argv);
}
/// Calls the user-configured 'shell' (p_sh) for running a command or wildcard
@@ -128,11 +128,11 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
emsg_silent,
forward_output);
- free(input.data);
+ xfree(input.data);
if (output) {
(void)write_output(output, nread, true, true);
- free(output);
+ xfree(output);
}
if (!emsg_silent && status != 0 && !(opts & kShellOptSilent)) {
@@ -250,7 +250,7 @@ static int shell(const char *cmd,
if (buf.len == 0) {
// no data received from the process, return NULL
*output = NULL;
- free(buf.data);
+ xfree(buf.data);
} else {
// NUL-terminate to make the output directly usable as a C string
buf.data[buf.len] = NUL;