[geos-commits] r3088 - trunk/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Aug 17 14:33:56 EDT 2010


Author: sgillies
Date: 2010-08-17 18:33:56 +0000 (Tue, 17 Aug 2010)
New Revision: 3088

Modified:
   trunk/capi/geos_ts_c.cpp
Log:
Throw runtime_error if allocation fails in gstrdup_s

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2010-07-26 22:21:07 UTC (rev 3087)
+++ trunk/capi/geos_ts_c.cpp	2010-08-17 18:33:56 UTC (rev 3088)
@@ -4,6 +4,7 @@
  *
  * C-Wrapper for GEOS library
  *
+ * Copyright (C) 2010 Sean Gillies <sean.gillies at gmail.com>
  * Copyright (C) 2010 Sandro Santilli <strk at keybit.net>
  * Copyright (C) 2005-2006 Refractions Research Inc.
  *
@@ -120,6 +121,8 @@
 
 using geos::algorithm::distance::DiscreteHausdorffDistance;
 
+using std::runtime_error;
+
 typedef std::auto_ptr<Geometry> GeomAutoPtr;
 
 typedef struct GEOSContextHandleInternal
@@ -162,6 +165,11 @@
     }
 
     assert(0 != out);
+    
+    // we haven't been checking allocation before ticket #371
+    if (0 == out)
+	      throw(runtime_error("Failed to allocate memory for duplicate string"));
+    
     return out;
 }
 



More information about the geos-commits mailing list