do not memcpy from NULL

This commit is contained in:
Benjamin Peterson 2016-09-06 19:03:40 -07:00
parent a1bc246dd5
commit 4a757609d1
1 changed files with 2 additions and 1 deletions

View File

@ -327,6 +327,7 @@ _Py_hashtable_set(_Py_hashtable_t *ht, const void *key,
entry->key_hash = key_hash;
assert(data_size == ht->data_size);
if (data)
memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size);
_Py_slist_prepend(&ht->buckets[index], (_Py_slist_item_t*)entry);