libc/blkoutstream: Zero the cache to avoid random data

and skip zero cache in lib_mtdoutstream_open since it's aleady done ih mtdoutstream_puts

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2024-08-19 01:19:29 +08:00
committed by archer
parent 00529f1626
commit fa57289d68
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -295,7 +295,7 @@ int lib_mtdoutstream_open(FAR struct lib_mtdoutstream_s *stream,
if (node->u.i_mtd->write == NULL)
#endif
{
stream->cache = lib_zalloc(stream->geo.erasesize);
stream->cache = lib_malloc(stream->geo.erasesize);
if (stream->cache == NULL)
{
close_mtddriver(node);