Fix missing/incomplete NULL checks in multiple source files (#104564)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
This commit is contained in:
chgnrdv 2023-05-23 23:01:17 +03:00 committed by GitHub
parent ae00b810d1
commit 13b5d79090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 1 deletions

View file

@ -2381,7 +2381,12 @@ get_local_timestamp(PyObject *dt, int64_t *local_ts)
/////
// Functions for cache handling
/* Constructor for StrongCacheNode */
/* Constructor for StrongCacheNode
*
* This function doesn't set MemoryError if PyMem_Malloc fails,
* as the cache intentionally doesn't propagate exceptions
* and fails silently if error occurs.
*/
static StrongCacheNode *
strong_cache_node_new(PyObject *key, PyObject *zone)
{
@ -2572,6 +2577,9 @@ update_strong_cache(zoneinfo_state *state, const PyTypeObject *const type,
}
StrongCacheNode *new_node = strong_cache_node_new(key, zone);
if (new_node == NULL) {
return;
}
StrongCacheNode **root = &(state->ZONEINFO_STRONG_CACHE);
move_strong_cache_node_to_front(state, root, new_node);