summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2012-08-20 09:04:14 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2012-08-20 09:04:14 +0000
commit70e72648e1a6e2477f1186f734f04e98d2f02e19 (patch)
treeade03ee7260dfd1273ab4ed3948f88cebabe156d
parent1ef335787d600f21b4dfccaf32d41ea5a5f97ddb (diff)
downloadATCD-70e72648e1a6e2477f1186f734f04e98d2f02e19.tar.gz
Mon Aug 20 09:03:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/Module.cpp: Fixed possible memory leak and dead code, uncovered by Coverity scan
-rw-r--r--ACE/ChangeLog5
-rw-r--r--ACE/ace/Module.cpp24
2 files changed, 16 insertions, 13 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index b28c689e8f7..6eb2ee19dbd 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug 20 09:03:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/Module.cpp:
+ Fixed possible memory leak and dead code, uncovered by Coverity scan
+
Mon Aug 20 08:36:46 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
* docs/ACE-monotonic-timer.html:
diff --git a/ACE/ace/Module.cpp b/ACE/ace/Module.cpp
index 6799d335cc0..23ce361d789 100644
--- a/ACE/ace/Module.cpp
+++ b/ACE/ace/Module.cpp
@@ -103,28 +103,20 @@ ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::open (const ACE_TCHAR *module_name,
if (writer_q == 0)
{
typedef ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY> TASK_TYPE;
- ACE_NEW_RETURN (writer_q,
- TASK_TYPE,
- -1);
+ ACE_NEW_NORETURN (writer_q,
+ TASK_TYPE);
ACE_SET_BITS (flags, M_DELETE_WRITER);
}
if (reader_q == 0)
{
typedef ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY> TASK_TYPE;
- ACE_NEW_RETURN (reader_q,
- TASK_TYPE,
- -1);
+ ACE_NEW_NORETURN (reader_q,
+ TASK_TYPE);
ACE_SET_BITS (flags, M_DELETE_READER);
}
- this->reader (reader_q);
- this->writer (writer_q);
-
- // Save the flags
- this->flags_ = flags;
-
- // Make sure that the memory is allocated before proceding.
+ // Make sure that the memory is allocated before proceeding.
if (writer_q == 0 || reader_q == 0)
{
// These calls will delete writer_q and/or reader_q, if
@@ -136,6 +128,12 @@ ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::open (const ACE_TCHAR *module_name,
return -1;
}
+ this->reader (reader_q);
+ this->writer (writer_q);
+
+ // Save the flags
+ this->flags_ = flags;
+
// Setup back pointers (this must come last, after we've made sure
// there's memory allocated here.
reader_q->mod_ = this;