mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-04 23:38:02 +02:00
Fix drm_realloc when you're reallocing into something smaller.
This commit is contained in:
parent
bffbb497e2
commit
b460aeec3e
2 changed files with 2 additions and 2 deletions
|
|
@ -69,7 +69,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
|
|||
if (pt == NULL)
|
||||
return NULL;
|
||||
if (oldpt && oldsize) {
|
||||
memcpy(pt, oldpt, oldsize);
|
||||
memcpy(pt, oldpt, DRM_MIN(oldsize,size));
|
||||
free(oldpt, M_DRM);
|
||||
}
|
||||
return pt;
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
|
|||
if (!(pt = kmalloc(size, GFP_KERNEL)))
|
||||
return NULL;
|
||||
if (oldpt && oldsize) {
|
||||
memcpy(pt, oldpt, oldsize);
|
||||
memcpy(pt, oldpt, DRM_MIN(oldsize,size));
|
||||
kfree(oldpt);
|
||||
}
|
||||
return pt;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue