From e303a11ebfc352860cce73184ece692ab4d0f01c Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Mon, 12 May 2014 16:19:50 -0300 Subject: Remove OOM checks: suggested changes in review - Replace a vim_strsave/free pair with xrealloc - Use xmallocz() in some places - Use xrealloc() and forget about the NULL pointer case - Remove invalid comment - Remove unnecessary checks - Replace a complicated xmalloc/STRCPY/free code chunk code with xrealloc() - Replace a vim_strsave/free code chunk with xrealloc() --- src/nvim/term.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/nvim/term.c') diff --git a/src/nvim/term.c b/src/nvim/term.c index 733bef8b5f..073ed30052 100644 --- a/src/nvim/term.c +++ b/src/nvim/term.c @@ -4304,14 +4304,9 @@ replace_termcodes ( } result[dlen] = NUL; - /* - * Copy the new string to allocated memory. - * If this fails, just return from. - */ - *bufp = vim_strsave(result); - from = *bufp; - free(result); - return from; + *bufp = xrealloc(result, dlen + 1); + + return *bufp; } /* -- cgit