When ttm_dma_tt_init() fails in nouveau_sgdma_create_ttm(), we should free the previously allocated memory before returning NULL.
Signed-off-by: Alexandre Courbot <[email protected]> --- drm/nouveau_sgdma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drm/nouveau_sgdma.c b/drm/nouveau_sgdma.c index 01707e7deaf5..e4fc494d688d 100644 --- a/drm/nouveau_sgdma.c +++ b/drm/nouveau_sgdma.c @@ -107,7 +107,10 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, else nvbe->ttm.ttm.func = &nv50_sgdma_backend; - if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) + if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) { + kfree(nvbe); return NULL; + } + return &nvbe->ttm.ttm; } -- 2.1.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
