Revert "lib: Make iscsi_realloc() update the freed pointer list"
iscsi_realloc MUST NOT be called with a pointer that is in the freelist
of small allocations. First they are free and secondly a realloc
will change the size of the small allocation to an unknown size.
This reverts commit d8de6531f8.
This commit is contained in:
@@ -60,19 +60,10 @@ void* iscsi_zmalloc(struct iscsi_context *iscsi, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* iscsi_realloc(struct iscsi_context *iscsi, void* ptr, size_t size) {
|
void* iscsi_realloc(struct iscsi_context *iscsi, void* ptr, size_t size) {
|
||||||
int i;
|
|
||||||
void * _ptr = realloc(ptr, size);
|
void * _ptr = realloc(ptr, size);
|
||||||
if (_ptr != NULL) {
|
if (_ptr != NULL) {
|
||||||
iscsi->reallocs++;
|
iscsi->reallocs++;
|
||||||
}
|
}
|
||||||
if (ptr != NULL) {
|
|
||||||
for (i = 0; i < iscsi->smalloc_free; i++) {
|
|
||||||
if (iscsi->smalloc_ptrs[i] == ptr) {
|
|
||||||
iscsi->smalloc_ptrs[i] = _ptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _ptr;
|
return _ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user