Commit 836b194d authored by Xin He's avatar Xin He Committed by Gerd Hoffmann

drm/virtio: fix memory leak in virtio_gpu_cleanup_object()

Before setting shmem->pages to NULL, kfree() should
be called.
Signed-off-by: default avatarXin He <hexin.op@bytedance.com>
Reviewed-by: default avatarQi Liu <liuqi.16@bytedance.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200722051851.72662-1-hexin.op@bytedance.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 8b6ec999
...@@ -79,6 +79,7 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object *bo) ...@@ -79,6 +79,7 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object *bo)
} }
sg_free_table(shmem->pages); sg_free_table(shmem->pages);
kfree(shmem->pages);
shmem->pages = NULL; shmem->pages = NULL;
drm_gem_shmem_unpin(&bo->base.base); drm_gem_shmem_unpin(&bo->base.base);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment