drm/virtio: fix memory leak of vfpriv on error return path
authorColin Ian King <colin.king@canonical.com>
Wed, 7 Nov 2018 20:31:22 +0000 (20:31 +0000)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 14 Nov 2018 13:21:03 +0000 (14:21 +0100)
commit040b595a91b21b61d6e0d388394b79c85f614e7c
treef9d039d6ba4c638da8e0706c6969622f8cab6cde
parent6862965261a09fc459815ba38efb758fc88006df
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: 6a37c49a94a9 ("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>
drivers/gpu/drm/virtio/virtgpu_kms.c