summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-09-06 19:03:40 -0700
committerBenjamin Peterson <benjamin@python.org>2016-09-06 19:03:40 -0700
commit4a757609d131a29ef52eddcae108b7052e13d31b (patch)
treec5a1213b0ca4df58d45c5583df936a8ddd00e580 /Modules
parenta1bc246dd5d86fc27fdcca708cf3eb2b2b803ac7 (diff)
downloadcpython-git-4a757609d131a29ef52eddcae108b7052e13d31b.tar.gz
do not memcpy from NULL
Diffstat (limited to 'Modules')
-rw-r--r--Modules/hashtable.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/hashtable.c b/Modules/hashtable.c
index 133f3133ef..fdddc19cff 100644
--- a/Modules/hashtable.c
+++ b/Modules/hashtable.c
@@ -327,7 +327,8 @@ _Py_hashtable_set(_Py_hashtable_t *ht, const void *key,
entry->key_hash = key_hash;
assert(data_size == ht->data_size);
- memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size);
+ if (data)
+ memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size);
_Py_slist_prepend(&ht->buckets[index], (_Py_slist_item_t*)entry);
ht->entries++;