mirror of https://github.com/python/cpython
bpo-41056: Fix a possible MemoryError leak within zoneinfo. (GH-21007)
This was detected by our Coverity scan as a REVERSE_INULL issue. Automerge-Triggered-By: @gpshead
This commit is contained in:
parent
81328f3070
commit
d780fa7931
|
@ -0,0 +1 @@
|
||||||
|
Fixed an instance where a MemoryError within the zoneinfo module might not be reported or not reported at its source. (found by Coverity)
|
|
@ -278,13 +278,11 @@ zoneinfo_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
||||||
|
|
||||||
instance =
|
instance =
|
||||||
PyObject_CallMethod(weak_cache, "setdefault", "OO", key, tmp);
|
PyObject_CallMethod(weak_cache, "setdefault", "OO", key, tmp);
|
||||||
((PyZoneInfo_ZoneInfo *)instance)->source = SOURCE_CACHE;
|
|
||||||
|
|
||||||
Py_DECREF(tmp);
|
Py_DECREF(tmp);
|
||||||
|
|
||||||
if (instance == NULL) {
|
if (instance == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
((PyZoneInfo_ZoneInfo *)instance)->source = SOURCE_CACHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_strong_cache(type, key, instance);
|
update_strong_cache(type, key, instance);
|
||||||
|
@ -1622,7 +1620,7 @@ parse_abbr(const char *const p, PyObject **abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
*abbr = PyUnicode_FromStringAndSize(str_start, str_end - str_start);
|
*abbr = PyUnicode_FromStringAndSize(str_start, str_end - str_start);
|
||||||
if (abbr == NULL) {
|
if (*abbr == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue