mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
Fixes a memory leak that is caused because the client message queue is not unlinked after the client disconnects from the NX server.
This commit is contained in:
committed by
Gregory Nutt
parent
e348ea70ff
commit
c33bde1f82
@@ -60,8 +60,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Each client is assigned a unique ID using the g_nxcid counter. That
|
||||
* counter increments as each new counter is created and is* protected for
|
||||
* thread safefy with g_nxlibsem. Note that these are the only global values
|
||||
* counter increments as each new counter is created and is protected for
|
||||
* thread safety with g_nxlibsem. Note that these are the only global values
|
||||
* in the NX implementation. This is because the client ID must be unique
|
||||
* even across all server instances.
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
@@ -70,6 +71,7 @@ void nx_disconnect(NXHANDLE handle)
|
||||
{
|
||||
FAR struct nxfe_conn_s *conn = (FAR struct nxfe_conn_s *)handle;
|
||||
struct nxsvrmsg_s outmsg;
|
||||
char climqname[NX_CLIENT_MXNAMELEN];
|
||||
int ret;
|
||||
|
||||
/* Inform the server that this client no longer exists */
|
||||
@@ -84,4 +86,10 @@ void nx_disconnect(NXHANDLE handle)
|
||||
{
|
||||
gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(climqname, sizeof(climqname),
|
||||
NX_CLIENT_MQNAMEFMT, conn->cid);
|
||||
(void)mq_unlink(climqname);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user