1
0
forked from aniani/vim

patch 9.0.1076: ASAN complains about NULL argument

Problem:    ASAN complains about NULL argument.
Solution:   Skip memmove() when there is nothing to move.
This commit is contained in:
Bram Moolenaar
2022-12-19 12:18:09 +00:00
parent c336ae3ce6
commit 8efdcee02e
2 changed files with 4 additions and 1 deletions

View File

@@ -164,7 +164,8 @@ add_members_to_class(
*members = gap->ga_len == 0 ? NULL : ALLOC_MULT(ocmember_T, gap->ga_len);
if (gap->ga_len > 0 && *members == NULL)
return FAIL;
mch_memmove(*members, gap->ga_data, sizeof(ocmember_T) * gap->ga_len);
if (gap->ga_len > 0)
mch_memmove(*members, gap->ga_data, sizeof(ocmember_T) * gap->ga_len);
VIM_CLEAR(gap->ga_data);
return OK;
}