Message174527
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;
} |
|
Date |
User |
Action |
Args |
2012-11-02 14:50:30 | christian.heimes | set | recipients:
+ christian.heimes, gvanrossum, ctheune, benjamin.peterson, ebfe, hynek |
2012-11-02 14:50:30 | christian.heimes | set | messageid: <1351867830.4.0.621324916198.issue16381@psf.upfronthosting.co.za> |
2012-11-02 14:50:30 | christian.heimes | link | issue16381 messages |
2012-11-02 14:50:30 | christian.heimes | create | |
|