[Rprotobuf-commits] r674 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 31 21:08:38 CET 2013


Author: murray
Date: 2013-12-31 21:08:38 +0100 (Tue, 31 Dec 2013)
New Revision: 674

Modified:
   pkg/src/ZeroCopyInputStreamWrapper.cpp
   pkg/src/ZeroCopyOutputStreamWrapper.cpp
Log:
Wrap destructors in try/catch to ensure we don't raise an exception
here.  From Flexelint.



Modified: pkg/src/ZeroCopyInputStreamWrapper.cpp
===================================================================
--- pkg/src/ZeroCopyInputStreamWrapper.cpp	2013-12-31 20:07:50 UTC (rev 673)
+++ pkg/src/ZeroCopyInputStreamWrapper.cpp	2013-12-31 20:08:38 UTC (rev 674)
@@ -8,11 +8,12 @@
 }
 
 ZeroCopyInputStreamWrapper::~ZeroCopyInputStreamWrapper() {
-    /* first clear the coded stream */
-    delete coded_stream;
-
-    /* then the stream itself */
-    delete stream;
+    try {
+	/* first clear the coded stream */
+	delete coded_stream;
+	/* then the stream itself */
+	delete stream;
+    } catch (...) { }
 }
 GPB::io::ZeroCopyInputStream* ZeroCopyInputStreamWrapper::get_stream() { return stream; }
 GPB::io::CodedInputStream* ZeroCopyInputStreamWrapper::get_coded_stream() { return coded_stream; }

Modified: pkg/src/ZeroCopyOutputStreamWrapper.cpp
===================================================================
--- pkg/src/ZeroCopyOutputStreamWrapper.cpp	2013-12-31 20:07:50 UTC (rev 673)
+++ pkg/src/ZeroCopyOutputStreamWrapper.cpp	2013-12-31 20:08:38 UTC (rev 674)
@@ -8,11 +8,12 @@
 }
 
 ZeroCopyOutputStreamWrapper::~ZeroCopyOutputStreamWrapper() {
-    /* first clear the coded stream */
-    delete coded_stream;
-
-    /* then the stream itself */
-    delete stream;
+    try {
+	/* first clear the coded stream */
+	delete coded_stream;
+	/* then the stream itself */
+	delete stream;
+    } catch (...) { }
 }
 GPB::io::ZeroCopyOutputStream* ZeroCopyOutputStreamWrapper::get_stream() { return stream; }
 GPB::io::CodedOutputStream* ZeroCopyOutputStreamWrapper::get_coded_stream() { return coded_stream; }



More information about the Rprotobuf-commits mailing list