gcc/analyzer: fix false positives for NULL (#13248)

Close https://github.com/neovim/neovim/issues/13158
This commit is contained in:
Jan Edmund Lazo
2020-11-08 22:48:17 -05:00
committed by GitHub
parent 94062831b3
commit 4e6f00dd29
4 changed files with 15 additions and 8 deletions

View File

@@ -159,8 +159,11 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
vim_snprintf((char *)IObuff, IOSIZE, idx_msg, idx);
ga_concat(&msg_ga, IObuff);
} else {
typval_T key_tv = *TV_LIST_ITEM_TV(
tv_list_first(TV_LIST_ITEM_TV(li)->vval.v_list));
assert(li != NULL);
listitem_T *const first_item =
tv_list_first(TV_LIST_ITEM_TV(li)->vval.v_list);
assert(first_item != NULL);
typval_T key_tv = *TV_LIST_ITEM_TV(first_item);
char *const key = encode_tv2echo(&key_tv, NULL);
vim_snprintf((char *) IObuff, IOSIZE, key_pair_msg, key, idx);
xfree(key);