mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
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.
This commit is contained in:
@@ -329,10 +329,10 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
||||
: STRCMP(p_sxq, "\"(") == 0 ? (char_u *)")\""
|
||||
: p_sxq);
|
||||
retval = os_call_shell(ncmd, opts, extra_shell_arg);
|
||||
free(ncmd);
|
||||
xfree(ncmd);
|
||||
|
||||
if (ecmd != cmd)
|
||||
free(ecmd);
|
||||
xfree(ecmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ int vim_chdir(char_u *new_dir)
|
||||
if (dir_name == NULL)
|
||||
return -1;
|
||||
r = os_chdir((char *)dir_name);
|
||||
free(dir_name);
|
||||
xfree(dir_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ char *read_string(FILE *fd, size_t cnt)
|
||||
for (size_t i = 0; i < cnt; i++) {
|
||||
int c = getc(fd);
|
||||
if (c == EOF) {
|
||||
free(str);
|
||||
xfree(str);
|
||||
return NULL;
|
||||
}
|
||||
str[i] = (uint8_t)c;
|
||||
|
Reference in New Issue
Block a user