| 61 |
61 |
| 62 // check if the array is still located on the stack |
62 // check if the array is still located on the stack |
| 63 void *newmem; |
63 void *newmem; |
| 64 if (array == alloc->ptr2) { |
64 if (array == alloc->ptr2) { |
| 65 newmem = cxMalloc(al, capacity * elem_size); |
65 newmem = cxMalloc(al, capacity * elem_size); |
| 66 if (newmem != NULL) { |
66 if (newmem != NULL && array != NULL) { |
| 67 memcpy(newmem, array, capacity * elem_size); |
67 memcpy(newmem, array, capacity * elem_size); |
| 68 } |
68 } |
| 69 } else { |
69 } else { |
| 70 newmem = cxRealloc(al, array, capacity * elem_size); |
70 newmem = cxRealloc(al, array, capacity * elem_size); |
| 71 } |
71 } |