You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pkarashchenko (via GitHub)" <gi...@apache.org> on 2023/09/24 05:19:22 UTC

[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #10785: local socket: fix accept used after free

pkarashchenko commented on code in PR #10785:
URL: https://github.com/apache/nuttx/pull/10785#discussion_r1335106400


##########
net/local/local_conn.c:
##########
@@ -225,4 +225,51 @@ void local_free(FAR struct local_conn_s *conn)
   kmm_free(conn);
 }
 
+/****************************************************************************
+ * Name: local_addref
+ *
+ * Description:
+ *   Increment the reference count on the underlying connection structure.
+ *
+ * Input Parameters:
+ *   psock - Socket structure of the socket whose reference count will be
+ *           incremented.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+void local_addref(FAR struct local_conn_s *conn)
+{
+  DEBUGASSERT(conn->lc_crefs >= 0 && conn->lc_crefs < 255);

Review Comment:
   Is `lc_crefs` signed? If not then need to change to
   
   ```suggestion
     DEBUGASSERT(conn->lc_crefs < 255);
   ```
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org