This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 06464bbc764679b921eba547efe8f6a5beaeb13f Author: wangmingrong1 <[email protected]> AuthorDate: Fri Oct 16 16:34:36 2026 +0800 video/mipidsi: keep the old host array when realloc fails Assigning the result straight back dropped the previous allocation. Signed-off-by: wangmingrong1 <[email protected]> --- drivers/video/mipidsi/mipi_dsi_host.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/video/mipidsi/mipi_dsi_host.c b/drivers/video/mipidsi/mipi_dsi_host.c index 02d78b4386d..54601f14fa3 100644 --- a/drivers/video/mipidsi/mipi_dsi_host.c +++ b/drivers/video/mipidsi/mipi_dsi_host.c @@ -114,9 +114,17 @@ int mipi_dsi_host_register(FAR struct mipi_dsi_host *host) } else { - g_hosts = kmm_realloc(g_hosts, sizeof(struct mipi_dsi_hosts_s) + - sizeof(FAR struct mipi_dsi_host *) * - g_hosts->count); + FAR struct mipi_dsi_hosts_s *hosts; + + hosts = kmm_realloc(g_hosts, sizeof(struct mipi_dsi_hosts_s) + + sizeof(FAR struct mipi_dsi_host *) * + g_hosts->count); + if (hosts == NULL) + { + return -ENOMEM; + } + + g_hosts = hosts; } if (g_hosts == NULL)
