Merge #7839 'coverity fixes'

This commit is contained in:
Justin M. Keyes 2018-01-15 22:31:11 +01:00 committed by GitHub
commit f09a30d5b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -11110,6 +11110,7 @@ void get_user_input(const typval_T *const argvars,
char defstr_buf[NUMBUFLEN];
char cancelreturn_buf[NUMBUFLEN];
char xp_name_buf[NUMBUFLEN];
char def[1] = { 0 };
if (argvars[0].v_type == VAR_DICT) {
if (argvars[1].v_type != VAR_UNKNOWN) {
emsgf(_("E5050: {opts} must be the only argument"));
@ -11124,7 +11125,6 @@ void get_user_input(const typval_T *const argvars,
if (defstr == NULL) {
return;
}
char def[1] = { 0 };
cancelreturn = tv_dict_get_string_buf_chk(dict, S_LEN("cancelreturn"),
cancelreturn_buf, def);
if (cancelreturn == NULL) { // error

View File

@ -285,7 +285,7 @@ typval_T decode_string(const char *const s, const size_t len,
.v_type = VAR_STRING,
.v_lock = VAR_UNLOCKED,
.vval = { .v_string = (char_u *)(
s_allocated ? (char *)s : xmemdupz(s, len)) },
(s == NULL || s_allocated) ? (char *)s : xmemdupz(s, len)) },
};
}
}