vim-patch:8.0.0595: Coverity warning for not checking return value

Problem:    Coverity warning for not checking return value of dict_add().
Solution:   Check the return value for FAIL.

beb9cb19c6
This commit is contained in:
James McCoy
2017-12-19 10:41:50 -05:00
parent 20708a07bf
commit 6fcadab3ce

View File

@@ -4147,7 +4147,9 @@ int get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
di = tv_dict_item_alloc_len(S_LEN("context")); di = tv_dict_item_alloc_len(S_LEN("context"));
if (di != NULL) { if (di != NULL) {
tv_copy(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); tv_copy(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv);
tv_dict_add(retdict, di); if (tv_dict_add(retdict, di) == FAIL) {
tv_dict_item_free(di);
}
} }
} else { } else {
status = tv_dict_add_str(retdict, S_LEN("context"), ""); status = tv_dict_add_str(retdict, S_LEN("context"), "");