Skip to content

Commit 47d3949

Browse files
Jianglei Niegregkh
authored andcommitted
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: c296d5f ("staging: fbtft: core support") Signed-off-by: Jianglei Nie <niejianglei2021@163.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Abdun Nihaal <abdun.nihaal@gmail.com> Link: https://patch.msgid.link/20251112192235.2088654-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e6ab504 commit 47d3949

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/staging/fbtft/fbtft-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,8 @@ int fbtft_probe_common(struct fbtft_display *display,
11711171
par->pdev = pdev;
11721172

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

11781178
/* write register functions */

0 commit comments

Comments
 (0)