From: Jiang Liu Date: Thu, 19 Dec 2013 12:38:21 +0000 (+0800) Subject: nouveau / ACPI: fix memory leak in ACPI _DSM related code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4988d0aeb6843b7070e406f8e6cb095c74e5f136;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git nouveau / ACPI: fix memory leak in ACPI _DSM related code Fix memory leak in function nouveau_optimus_dsm() and nouveau_dsm(). Signed-off-by: Jiang Liu Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index ba0183fb84f3..3f721e317fef 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -111,6 +111,7 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * if (obj->type == ACPI_TYPE_INTEGER) if (obj->integer.value == 0x80000002) { + kfree(output.pointer); return -ENODEV; } @@ -157,8 +158,10 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result) obj = (union acpi_object *)output.pointer; if (obj->type == ACPI_TYPE_INTEGER) - if (obj->integer.value == 0x80000002) + if (obj->integer.value == 0x80000002) { + kfree(output.pointer); return -ENODEV; + } if (obj->type == ACPI_TYPE_BUFFER) { if (obj->buffer.length == 4 && result) {