FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.13] gh-151126: Fix missing memory errors in `_interpchannelsmodule.c` (GH-151239) by sobolevn · Pull Request #151338 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix a crash, when there's no memory left on a device,
which happened in :mod:`!_interpchannels` module.

Now it raises proper :exc:`MemoryError` errors.
6 changes: 5 additions & 1 deletion Modules/_interpchannelsmodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,8 @@ static _channelends *
_channelends_new(void)
{
_channelends *ends = GLOBAL_MALLOC(_channelends);
if (ends== NULL) {
if (ends == NULL) {
PyErr_NoMemory();
return NULL;
}
ends->numsendopen = 0;
Expand Down Expand Up @@ -1095,6 +1096,7 @@ _channel_new(PyThread_type_lock mutex, int unboundop)
{
_channel_state *chan = GLOBAL_MALLOC(_channel_state);
if (chan == NULL) {
PyErr_NoMemory();
return NULL;
}
chan->mutex = mutex;
Expand Down Expand Up @@ -1295,6 +1297,7 @@ _channelref_new(int64_t cid, _channel_state *chan)
{
_channelref *ref = GLOBAL_MALLOC(_channelref);
if (ref == NULL) {
PyErr_NoMemory();
return NULL;
}
ref->cid = cid;
Expand Down Expand Up @@ -1680,6 +1683,7 @@ _channel_set_closing(_channelref *ref, PyThread_type_lock mutex) {
}
chan->closing = GLOBAL_MALLOC(struct _channel_closing);
if (chan->closing == NULL) {
PyErr_NoMemory();
goto done;
}
chan->closing->ref = ref;
Expand Down
Loading

Back | FazBrowse Home | New Git URL