Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e6fcab

Browse filesBrowse files
authored
Fix some missing null checks. (GH-118721)
1 parent 17a2cc1 commit 7e6fcab
Copy full SHA for 7e6fcab

File tree

2 files changed

+13
-5
lines changed
Filter options

2 files changed

+13
-5
lines changed

‎Objects/typeobject.c

Copy file name to clipboardExpand all lines: Objects/typeobject.c
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6036,15 +6036,19 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
60366036
return NULL;
60376037
}
60386038
comma_w_quotes_sep = PyUnicode_FromString("', '");
6039+
if (!comma_w_quotes_sep) {
6040+
Py_DECREF(sorted_methods);
6041+
return NULL;
6042+
}
60396043
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);
60426045
if (joined == NULL) {
6043-
Py_DECREF(comma_w_quotes_sep);
6046+
Py_DECREF(sorted_methods);
60446047
return NULL;
60456048
}
6049+
method_count = PyObject_Length(sorted_methods);
6050+
Py_DECREF(sorted_methods);
60466051
if (method_count == -1) {
6047-
Py_DECREF(comma_w_quotes_sep);
60486052
Py_DECREF(joined);
60496053
return NULL;
60506054
}
@@ -6056,7 +6060,6 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
60566060
method_count > 1 ? "s" : "",
60576061
joined);
60586062
Py_DECREF(joined);
6059-
Py_DECREF(comma_w_quotes_sep);
60606063
return NULL;
60616064
}
60626065
PyObject *obj = type->tp_alloc(type, 0);

‎PC/launcher2.c

Copy file name to clipboardExpand all lines: PC/launcher2.c
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2707,6 +2707,11 @@ process(int argc, wchar_t ** argv)
27072707
DWORD len = GetEnvironmentVariableW(L"PYLAUNCHER_LIMIT_TO_COMPANY", NULL, 0);
27082708
if (len > 1) {
27092709
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+
}
27102715
search.limitToCompany = limitToCompany;
27112716
if (0 == GetEnvironmentVariableW(L"PYLAUNCHER_LIMIT_TO_COMPANY", limitToCompany, len)) {
27122717
exitCode = RC_INTERNAL_ERROR;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.