mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +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
|
/* 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
|
* 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
|
* 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
|
* in the NX implementation. This is because the client ID must be unique
|
||||||
* even across all server instances.
|
* even across all server instances.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <debug.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;
|
FAR struct nxfe_conn_s *conn = (FAR struct nxfe_conn_s *)handle;
|
||||||
struct nxsvrmsg_s outmsg;
|
struct nxsvrmsg_s outmsg;
|
||||||
|
char climqname[NX_CLIENT_MXNAMELEN];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Inform the server that this client no longer exists */
|
/* 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);
|
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