提交 d8eca110 编写于 作者: A Axel Lin 提交者: Matthew Garrett

asus-laptop: fix a memory leak in asus_laptop_get_info error path

The callers of write_acpi_int_ret() pass ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

This patch adds a missing kfree(buffer.pointer) before return -ENOMEM
if kstrdup fail.
Signed-off-by: NAxel Lin <axel.lin@gmail.com>
Acked-by: NCorentin Chary <corentincj@iksaif.net>
Signed-off-by: NMatthew Garrett <mjg@redhat.com>
上级 1492616a
......@@ -1397,8 +1397,10 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
}
}
asus->name = kstrdup(string, GFP_KERNEL);
if (!asus->name)
if (!asus->name) {
kfree(buffer.pointer);
return -ENOMEM;
}
if (*string)
pr_notice(" %s model detected\n", string);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册