void * realloc(void * ptr, size_t size) { struct Malloc * head = malloc_begin; while (head) { if (head->a==ptr) { struct Malloc * newmem; if (head->size >= size) return head->a; /* no problem */ /* otherwise allocate new and copy over */ newmem = findFirstFree(size); if (!newmem) return NULL; memcpy(newmem->a,head->a,size); free(head->a); return newmem->a; } head=head->next; } fprintf(stderr,"attempt to realloc memory unknown to allocator\n"); return NULL; }