fs/vfs/fs_close.c: avoid double free if CONFIG_FS_NOTIFY is set

Double free occurred in lib_put_pathbuffer if CONFIG_FS_NOTIFY option
was enabled. The second if statement has to be called only if the
close operation returned error. The bug was introduced in 14f5c48
and was causing misc/lib_tempbuffer.c:141 debug assertion.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc 2025-06-16 09:38:13 +02:00 committed by Xiang Xiao
parent 81f27bd602
commit 01bfa1a500

View file

@ -139,9 +139,8 @@ int file_close(FAR struct file *filep)
inode_release(inode);
}
#ifdef CONFIG_FS_NOTIFY
if (path != NULL)
else if (path != NULL)
{
lib_put_pathbuffer(path);
}