scummvm random work
[patches.git] / alloc.c.patch
1 --- alloc.c~ 2006-05-10 18:07:00.000000000 +0200
2 +++ alloc.c 2006-05-10 18:08:54.000000000 +0200
3 @@ -90,7 +90,9 @@
4
5 newptr = malloc(size);
6 if (newptr) {
7 - memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t))));
8 + size_t old_size = *((size_t *) (ptr - sizeof(size_t)));
9 + if(old_size < size) size = old_size;
10 + memcpy(newptr, ptr, size);
11 free(ptr);
12 }
13 return newptr;