From e4463d2578507ffee2acbfddb013c7e9461726c5 Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Fri, 8 Nov 2002 23:44:31 +0000 Subject: [PATCH] fix memory leaks git-svn-id: svn://10.0.0.236/trunk@133431 18797224-902f-48f8-a5cc-f745e15eee43 --- .../modules/ipc/daemon/ipcCommandModule.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mozilla/modules/ipc/daemon/ipcCommandModule.cpp b/mozilla/modules/ipc/daemon/ipcCommandModule.cpp index a6cdef270ef..433cd9d0634 100644 --- a/mozilla/modules/ipc/daemon/ipcCommandModule.cpp +++ b/mozilla/modules/ipc/daemon/ipcCommandModule.cpp @@ -57,7 +57,8 @@ struct ipcCommandModule { LOG(("got PING\n")); - IPC_SendMsg(client, new ipcmMessagePing()); + ipcmMessagePing out; + IPC_SendMsg(client, &out); } static void OnClientHello(ipcClient *client, const ipcMessage *rawMsg) @@ -69,7 +70,8 @@ struct ipcCommandModule if (name) client->AddName(name); - IPC_SendMsg(client, new ipcmMessageClientID(client->ID())); + ipcmMessageClientID out(client->ID()); + IPC_SendMsg(client, &out); } static void OnClientAddName(ipcClient *client, const ipcMessage *rawMsg) @@ -116,11 +118,13 @@ struct ipcCommandModule ipcClient *result = IPC_GetClientByName(msg->Name()); if (result) { LOG((" client exists w/ ID = %u\n", result->ID())); - IPC_SendMsg(client, new ipcmMessageClientID(result->ID())); + ipcmMessageClientID out(result->ID()); + IPC_SendMsg(client, &out); } else { LOG((" client does not exist\n")); - IPC_SendMsg(client, new ipcmMessageError(IPCM_ERROR_CLIENT_NOT_FOUND)); + ipcmMessageError out(IPCM_ERROR_CLIENT_NOT_FOUND); + IPC_SendMsg(client, &out); } } @@ -131,17 +135,17 @@ struct ipcCommandModule ipcMessageCast msg(rawMsg); PRUint32 destID = msg->DestClientID(); - ipcMessage *newMsg = new ipcMessage(); - newMsg->Init(msg->InnerTarget(), - msg->InnerData(), - msg->InnerDataLen()); + ipcMessage newMsg; + newMsg.Init(msg->InnerTarget(), + msg->InnerData(), + msg->InnerDataLen()); ipcClient *dest = IPC_GetClientByID(destID); if (!dest) { LOG((" destination client not found!\n")); return; } - IPC_SendMsg(dest, newMsg); + IPC_SendMsg(dest, &newMsg); } //