summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonkyu Kwon <wonkyu.kwon@samsung.com>2013-05-22 13:54:59 +0900
committerWonkyu Kwon <wonkyu.kwon@samsung.com>2013-07-24 17:56:37 +0900
commit865275e949f32206250e524552d73f4677414f45 (patch)
tree62f53b6ae8cd5abde6231c6af2384d10669530bb
parent213967a15edd52063d98130036624dfb2eb4960a (diff)
downloadsmartcard-service-865275e949f32206250e524552d73f4677414f45.tar.gz
smartcard-service-865275e949f32206250e524552d73f4677414f45.tar.bz2
smartcard-service-865275e949f32206250e524552d73f4677414f45.zip
Fix memory leaks
- free message in g_source callback Change-Id: I0bcb25ee8135390774080484f19e3c442e692495
-rw-r--r--client/ClientChannel.cpp2
-rw-r--r--client/ClientDispatcher.cpp16
-rw-r--r--client/Reader.cpp2
-rw-r--r--client/SEService.cpp4
-rw-r--r--client/Session.cpp4
5 files changed, 18 insertions, 10 deletions
diff --git a/client/ClientChannel.cpp b/client/ClientChannel.cpp
index f7bc165..7426e18 100644
--- a/client/ClientChannel.cpp
+++ b/client/ClientChannel.cpp
@@ -319,6 +319,8 @@ namespace smartcard_service_api
break;
}
+ delete msg;
+
return result;
}
} /* namespace smartcard_service_api */
diff --git a/client/ClientDispatcher.cpp b/client/ClientDispatcher.cpp
index 5161104..4a2e0dc 100644
--- a/client/ClientDispatcher.cpp
+++ b/client/ClientDispatcher.cpp
@@ -98,10 +98,10 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_READERS :
case Message::MSG_REQUEST_SHUTDOWN :
{
+ DispatcherMsg *tempMsg = new DispatcherMsg(msg);
+
if (msg->isSynchronousCall() == false)
{
- DispatcherMsg *tempMsg = new DispatcherMsg(msg);
-
/* Asynchronous call */
g_idle_add((GSourceFunc)&SEService::dispatcherCallback, (gpointer)tempMsg);
}
@@ -116,10 +116,10 @@ namespace smartcard_service_api
/* Reader requests */
case Message::MSG_REQUEST_OPEN_SESSION :
{
+ DispatcherMsg *tempMsg = new DispatcherMsg(msg);
+
if (msg->isSynchronousCall() == false)
{
- DispatcherMsg *tempMsg = new DispatcherMsg(msg);
-
/* Asynchronous call */
g_idle_add((GSourceFunc)&Reader::dispatcherCallback, (gpointer)tempMsg);
}
@@ -137,10 +137,10 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_CLOSE_SESSION :
case Message::MSG_REQUEST_GET_CHANNEL_COUNT :
{
+ DispatcherMsg *tempMsg = new DispatcherMsg(msg);
+
if (msg->isSynchronousCall() == false)
{
- DispatcherMsg *tempMsg = new DispatcherMsg(msg);
-
/* Asynchronous call */
g_idle_add((GSourceFunc)&Session::dispatcherCallback, (gpointer)tempMsg);
}
@@ -156,10 +156,10 @@ namespace smartcard_service_api
case Message::MSG_REQUEST_TRANSMIT :
case Message::MSG_REQUEST_CLOSE_CHANNEL :
{
+ DispatcherMsg *tempMsg = new DispatcherMsg(msg);
+
if (msg->isSynchronousCall() == false)
{
- DispatcherMsg *tempMsg = new DispatcherMsg(msg);
-
/* Asynchronous call */
g_idle_add((GSourceFunc)&ClientChannel::dispatcherCallback, (gpointer)tempMsg);
}
diff --git a/client/Reader.cpp b/client/Reader.cpp
index 4d46906..1cec00c 100644
--- a/client/Reader.cpp
+++ b/client/Reader.cpp
@@ -243,6 +243,8 @@ namespace smartcard_service_api
break;
}
+ delete msg;
+
_END();
return result;
diff --git a/client/SEService.cpp b/client/SEService.cpp
index 903320c..dc98793 100644
--- a/client/SEService.cpp
+++ b/client/SEService.cpp
@@ -292,7 +292,7 @@ namespace smartcard_service_api
bool SEService::dispatcherCallback(void *message)
{
Message *msg = (Message *)message;
- SEService *service = NULL;
+ SEService *service;
bool result = false;
_BEGIN();
@@ -423,6 +423,8 @@ namespace smartcard_service_api
break;
}
+ delete msg;
+
_END();
return result;
diff --git a/client/Session.cpp b/client/Session.cpp
index 8fa7b4c..c2e6a77 100644
--- a/client/Session.cpp
+++ b/client/Session.cpp
@@ -476,7 +476,7 @@ namespace smartcard_service_api
bool Session::dispatcherCallback(void *message)
{
Message *msg = (Message *)message;
- Session *session = NULL;
+ Session *session;
bool result = false;
if (msg == NULL)
@@ -613,6 +613,8 @@ namespace smartcard_service_api
break;
}
+ delete msg;
+
return result;
}
} /* namespace smartcard_service_api */