GeezerVison is showing github.com — Fix some missing null checks. (GH-118721) · miss-islington/cpython@fce9a26
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Objects/typeobject.c +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6036,15 +6036,19 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
6036 | 6036 | return NULL; |
6037 | 6037 | } |
6038 | 6038 | comma_w_quotes_sep = PyUnicode_FromString("', '"); |
| 6039 | + if (!comma_w_quotes_sep) { |
| 6040 | + Py_DECREF(sorted_methods); |
| 6041 | + return NULL; |
| 6042 | + } |
6039 | 6043 | joined = PyUnicode_Join(comma_w_quotes_sep, sorted_methods); |
6040 | | - method_count = PyObject_Length(sorted_methods); |
6041 | | - Py_DECREF(sorted_methods); |
| 6044 | + Py_DECREF(comma_w_quotes_sep); |
6042 | 6045 | if (joined == NULL) { |
6043 | | - Py_DECREF(comma_w_quotes_sep); |
| 6046 | + Py_DECREF(sorted_methods); |
6044 | 6047 | return NULL; |
6045 | 6048 | } |
| 6049 | + method_count = PyObject_Length(sorted_methods); |
| 6050 | + Py_DECREF(sorted_methods); |
6046 | 6051 | if (method_count == -1) { |
6047 | | - Py_DECREF(comma_w_quotes_sep); |
6048 | 6052 | Py_DECREF(joined); |
6049 | 6053 | return NULL; |
6050 | 6054 | } |
@@ -6056,7 +6060,6 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
6056 | 6060 | method_count > 1 ? "s" : "", |
6057 | 6061 | joined); |
6058 | 6062 | Py_DECREF(joined); |
6059 | | - Py_DECREF(comma_w_quotes_sep); |
6060 | 6063 | return NULL; |
6061 | 6064 | } |
6062 | 6065 | PyObject *obj = type->tp_alloc(type, 0); |
|
Collapse file
Copy file name to clipboardExpand all lines: PC/launcher2.c +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2707,6 +2707,11 @@ process(int argc, wchar_t ** argv) |
2707 | 2707 | DWORD len = GetEnvironmentVariableW(L"PYLAUNCHER_LIMIT_TO_COMPANY", NULL, 0); |
2708 | 2708 | if (len > 1) { |
2709 | 2709 | wchar_t *limitToCompany = allocSearchInfoBuffer(&search, len); |
| 2710 | + if (!limitToCompany) { |
| 2711 | + exitCode = RC_NO_MEMORY; |
| 2712 | + winerror(0, L"Failed to allocate internal buffer"); |
| 2713 | + goto abort; |
| 2714 | + } |
2710 | 2715 | search.limitToCompany = limitToCompany; |
2711 | 2716 | if (0 == GetEnvironmentVariableW(L"PYLAUNCHER_LIMIT_TO_COMPANY", limitToCompany, len)) { |
2712 | 2717 | exitCode = RC_INTERNAL_ERROR; |
|