xiaoxiang781216 commented on code in PR #19544:
URL: https://github.com/apache/nuttx/pull/19544#discussion_r3652962946
##########
sched/addrenv/addrenv.c:
##########
@@ -415,6 +425,16 @@ void addrenv_take(FAR struct addrenv_s *addrenv)
int addrenv_give(FAR struct addrenv_s *addrenv)
{
+ /* See addrenv_take(): nothing was counted, so nothing is given back. A
+ * non-zero count is returned so that callers never conclude the (absent)
+ * address environment has become unreferenced and should be destroyed.
+ */
+
+ if (addrenv == NULL)
+ {
+ return 1;
+ }
+
return atomic_fetch_sub(&addrenv->refs, 1) - 1;
Review Comment:
```suggestion
return addrenv ? atomic_fetch_sub(&addrenv->refs, 1) - 1 : 1;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]