No OOM in concat_str() (few remaining cases)

Also fixed the duplicated declaration (path.c and strings.c)
This commit is contained in:
Felipe Oliveira Carvalho
2014-05-31 00:40:07 -03:00
parent 3a9a76c996
commit 85100bb01d
2 changed files with 7 additions and 14 deletions

View File

@@ -11914,15 +11914,10 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
* concatenate the remainders. */
q = path_next_component(vim_ispathsep(*buf) ? buf + 1 : buf);
if (*q != NUL) {
if (remain == NULL)
remain = vim_strsave(q - 1);
else {
cpy = concat_str(q - 1, remain);
if (cpy != NULL) {
free(remain);
remain = cpy;
}
}
cpy = remain;
remain = remain ?
concat_str(q - 1, remain) : (char_u *) xstrdup((char *)q - 1);
free(cpy);
q[-1] = NUL;
}
@@ -11978,10 +11973,8 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
|| vim_ispathsep(p[2])))))) {
/* Prepend "./". */
cpy = concat_str((char_u *)"./", p);
if (cpy != NULL) {
free(p);
p = cpy;
}
free(p);
p = cpy;
} else if (!is_relative_to_current) {
/* Strip leading "./". */
q = p;