Revision 1a6f0dbc

b/linux-user/mmap.c
123 123
    munmap(p, *p);
124 124
}
125 125

  
126
void *qemu_realloc(void *ptr, size_t size)
127
{
128
    size_t old_size, copy;
129
    void *new_ptr;
130

  
131
    old_size = *(size_t *)((char *)ptr - 16);
132
    copy = old_size < size ? old_size : size;
133
    new_ptr = qemu_malloc(size);
134
    memcpy(new_ptr, ptr, copy);
135
    qemu_free(ptr);
136
    return new_ptr;
137
}
138

  
126 139
/* NOTE: all the constants are the HOST ones, but addresses are target. */
127 140
int target_mprotect(abi_ulong start, abi_ulong len, int prot)
128 141
{

Also available in: Unified diff