Christian Heimes added the comment:
Of course it can be fixed. But it's going to be a long and tedious piece of
work. PyErr_NoMemory() is called 314 times. MemoryError is raised about 40
times in C code.
I'm not sure what your question about realloc() really is. Are you unsure how a
a failing realloc() calls must be resolved?
Code like
ptr = realloc(ptr, size);
is usually a memory leak as it leaks the previously allocated memory in ptr. In
the error case the block in ptr is left untouched and is still valid. It must
be freed manually or can be used further and freed later.
if((ptr2 == realloc(ptr, size)) == NULL) {
free(ptr);
}
else {
ptr = ptr2;
}
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16381>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com