< prev index next >

src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp

Print this page
rev 50364 : 8204211: windows : handle potential C++ exception in GDIRenderer

@@ -83,11 +83,15 @@
     if ((close && !isclosed) || fixend) {
         outpoints++;
         *pNpoints = outpoints;
     }
     if (outpoints > POLYTEMPSIZE) {
+        try {
         pPoints = (POINT *) SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(POINT), outpoints);
+        } catch (const std::bad_alloc&) {
+            return NULL;
+        }
     }
     BOOL isempty = fixend;
     for (int i = 0; i < npoints; i++) {
         x = xpoints[i];
         y = ypoints[i];
< prev index next >