sched: group: Fix memory corruption in group_leave.c

Summary:
- I noticed that nxplayer (HTTP audio streaming) + command execution
  via telnet sometimes causes memory corruption.
  See https://github.com/apache/nuttx/pull/7947 for the detail.
- This commit fixes this issue by calling lib_stream_release() before
  lib_stream_release() in group_leave.c

Impact:
- Should be none

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2022-12-29 08:49:03 +09:00 committed by Xiang Xiao
parent 2e59d832fc
commit 6992a8f4cc
1 changed files with 6 additions and 6 deletions

View File

@ -156,6 +156,12 @@ static inline void group_release(FAR struct task_group_s *group)
pthread_release(group);
#endif
#ifdef CONFIG_FILE_STREAM
/* Free resource held by the stream list */
lib_stream_release(group);
#endif /* CONFIG_FILE_STREAM */
/* Free all file-related resources now. We really need to close files as
* soon as possible while we still have a functioning task.
*/
@ -164,12 +170,6 @@ static inline void group_release(FAR struct task_group_s *group)
files_releaselist(&group->tg_filelist);
#ifdef CONFIG_FILE_STREAM
/* Free resource held by the stream list */
lib_stream_release(group);
#endif /* CONFIG_FILE_STREAM */
#ifndef CONFIG_DISABLE_ENVIRON
/* Release all shared environment variables */