Commit fc49d868 authored by 's avatar
Browse files

fix snall memory leak in mapi_stats


git-svn-id: file:///home/svn/mapi/trunk@1282 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent d4a82c40
......@@ -2139,41 +2139,11 @@ cmd_stats (char *device, int pid, uid_t uid, int sock) /*removed id, id==pid her
}
else
{
//check if this is the first time we hear from this client
cl = flist_get (clientlist, pid);
if (cl == NULL)
{
cl = (struct client *) malloc (sizeof (struct client));
cl->pid = pid;
cl->sock = sock;
// init the list that holds references to the flows of this client
if ((cl->flowlist = malloc (sizeof (flist_t))) == NULL)
{
ERROR_CMD (printf
("cmd_create_flow:malloc new client struct: %s [%s:%d]\n",
strerror (errno), __FILE__, __LINE__));
exit (EXIT_FAILURE);
}
flist_init (cl->flowlist);
if ((cl->devicelist = malloc (sizeof (flist_t))) == NULL)
{
ERROR_CMD (printf
("cmd_create_flow:malloc new client struct: %s [%s:%d]\n",
strerror (errno), __FILE__, __LINE__));
exit (EXIT_FAILURE);
}
flist_init (cl->devicelist);
cl->numflows = 0;
cl->numdevs = 0;
flist_append (clientlist, pid, cl);
}
//Send ack back to user
buf.mtype = pid;
memcpy ((char *)buf.data, &stats, sizeof(struct mapi_stat));
buf.cmd = MAPI_STATS_ACK;
buf.fd = 0;
}
mapiipc_daemon_write (&buf, sock);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment