mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
drm/virtio: fix memory leak of vfpriv on error return path
The allocation for vfpriv is being leaked on an error return path,
fix this by kfree'ing it before returning.
Detected by CoverityScan, CID#1475380 ("Resource Leak")
Fixes: 6a37c49a94
("drm/virtio: Handle context ID allocation errors")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181107203122.6861-1-colin.king@canonical.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
6862965261
commit
040b595a91
1 changed files with 3 additions and 1 deletions
|
@ -267,8 +267,10 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file)
|
|||
|
||||
get_task_comm(dbgname, current);
|
||||
id = virtio_gpu_context_create(vgdev, strlen(dbgname), dbgname);
|
||||
if (id < 0)
|
||||
if (id < 0) {
|
||||
kfree(vfpriv);
|
||||
return id;
|
||||
}
|
||||
|
||||
vfpriv->ctx_id = id;
|
||||
file->driver_priv = vfpriv;
|
||||
|
|
Loading…
Add table
Reference in a new issue