drm_do_addbufs_pci: Fix the mess of malloc()s and free()s, which

do not accept NULL arguments.
Found via CID: 4439
This commit is contained in:
rmind 2007-04-04 00:30:58 +00:00
parent 5770bb4c31
commit 084180cb58
1 changed files with 6 additions and 2 deletions

View File

@ -587,8 +587,12 @@ static int drm_do_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
if (entry->buflist == NULL || entry->seglist == NULL ||
temp_pagelist == NULL) {
free(entry->buflist, M_DRM);
free(entry->seglist, M_DRM);
if (temp_pagelist)
free(temp_pagelist, M_DRM);
if (entry->seglist)
free(entry->seglist, M_DRM);
if (entry->buflist)
free(entry->buflist, M_DRM);
return DRM_ERR(ENOMEM);
}