mirror of
https://github.com/python/cpython
synced 2026-09-29 11:35:29 +03:00
gh-86493: Fix possible leaks in some modules initialization (GH-106768)
Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time.
This commit is contained in:
parent
83ac128490
commit
3e65baee72
8 changed files with 37 additions and 45 deletions
|
|
@ -13466,7 +13466,7 @@ setup_confname_table(struct constdef *table, size_t tablesize,
|
|||
}
|
||||
Py_DECREF(o);
|
||||
}
|
||||
return PyModule_AddObject(module, tablename, d);
|
||||
return PyModule_Add(module, tablename, d);
|
||||
}
|
||||
|
||||
/* Return -1 on failure, 0 on success. */
|
||||
|
|
@ -16781,11 +16781,9 @@ posixmodule_exec(PyObject *m)
|
|||
#endif
|
||||
|
||||
/* Initialize environ dictionary */
|
||||
PyObject *v = convertenviron();
|
||||
Py_XINCREF(v);
|
||||
if (v == NULL || PyModule_AddObject(m, "environ", v) != 0)
|
||||
if (PyModule_Add(m, "environ", convertenviron()) != 0) {
|
||||
return -1;
|
||||
Py_DECREF(v);
|
||||
}
|
||||
|
||||
if (all_ins(m))
|
||||
return -1;
|
||||
|
|
@ -16900,9 +16898,7 @@ posixmodule_exec(PyObject *m)
|
|||
Py_DECREF(unicode);
|
||||
}
|
||||
|
||||
PyModule_AddObject(m, "_have_functions", list);
|
||||
|
||||
return 0;
|
||||
return PyModule_Add(m, "_have_functions", list);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue