drm/vkms: Fix possible memory leak in _vkms_get_crc()

'vaddr_out' is malloced in _vkms_get_crc() and should be freed before
leaving from the error handling cases, otherwise it will cause memory
leak.

Fixes: db7f419c06 ("drm/vkms: Compute CRC with Cursor Plane")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1536976399-1295-1-git-send-email-weiyongjun1@huawei.com
This commit is contained in:
Wei Yongjun 2018-09-15 01:53:19 +00:00 committed by Daniel Vetter
parent 4f724df717
commit 14e86c0141
1 changed files with 1 additions and 0 deletions

View File

@ -125,6 +125,7 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc,
mutex_lock(&vkms_obj->pages_lock);
if (WARN_ON(!vkms_obj->vaddr)) {
mutex_unlock(&vkms_obj->pages_lock);
kfree(vaddr_out);
return crc;
}