fs/rpmsgfs: Zero dirs after realloc to avoid stale data

since many places assume the null pointer as an unused entry

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-06-25 03:56:35 +08:00 committed by Alan Carvalho de Assis
parent d33f90b78c
commit 987b01221c

View File

@ -285,6 +285,9 @@ static int rpmsgfs_attach_dir(FAR struct rpmsgfs_server_s *priv,
return -ENOMEM;
}
memset(&tmp[priv->dir_nums], 0, sizeof(FAR void *) *
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK);
priv->dirs = tmp;
priv->dir_nums += CONFIG_NFILE_DESCRIPTORS_PER_BLOCK;