mirror of
https://github.com/python/cpython.git
synced 2026-06-28 03:41:13 +00:00
[3.15] gh-151773: Fix NULL dereference in PyContextVar_Set (GH-151836) (#152009)
gh-151773: Fix NULL dereference in `PyContextVar_Set` (GH-151836)
(cherry picked from commit d35b1719a5)
Co-authored-by: dev <b.chouksey27@gmail.com>
This commit is contained in:
parent
672825e2f3
commit
7b765a47b8
2 changed files with 5 additions and 0 deletions
|
|
@ -362,6 +362,9 @@ PyContextVar_Set(PyObject *ovar, PyObject *val)
|
|||
Py_XINCREF(old_val);
|
||||
PyContextToken *tok = token_new(ctx, var, old_val);
|
||||
Py_XDECREF(old_val);
|
||||
if (tok == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (contextvar_set(var, val)) {
|
||||
Py_DECREF(tok);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue