Commit 47d3949a authored by Jianglei Nie's avatar Jianglei Nie Committed by Greg Kroah-Hartman
Browse files

staging: fbtft: core: fix potential memory leak in fbtft_probe_common()



fbtft_probe_common() allocates a memory chunk for "info" with
fbtft_framebuffer_alloc(). When "display->buswidth == 0" is true, the
function returns without releasing the "info", which will lead to a
memory leak.

Fix it by calling fbtft_framebuffer_release() when "display->buswidth
== 0" is true.

Fixes: c296d5f9 ("staging: fbtft: core support")
Signed-off-by: default avatarJianglei Nie <niejianglei2021@163.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarAbdun Nihaal <abdun.nihaal@gmail.com>
Link: https://patch.msgid.link/20251112192235.2088654-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6ab5046
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1171,8 +1171,8 @@ int fbtft_probe_common(struct fbtft_display *display,
	par->pdev = pdev;

	if (display->buswidth == 0) {
		dev_err(dev, "buswidth is not set\n");
		return -EINVAL;
		ret = dev_err_probe(dev, -EINVAL, "buswidth is not set\n");
		goto out_release;
	}

	/* write register functions */