Fix drm_realloc when you're reallocing into something smaller.
parent
bffbb497e2
commit
b460aeec3e
|
@ -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…
Reference in New Issue