8013454: [parfait] Memory leak in jdk/src/windows/native/sun/windows/awt_Cursor.cpp
8012079: [parfait] possible null pointer dereference in jdk/src/windows/native/sun/windows/awt_Font.cpp

Reviewed-by: art, serb
diff --git a/jdk/src/windows/native/sun/windows/awt_Cursor.cpp b/jdk/src/windows/native/sun/windows/awt_Cursor.cpp
index 477fe80..7901601 100644
--- a/jdk/src/windows/native/sun/windows/awt_Cursor.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Cursor.cpp
@@ -391,9 +391,16 @@
 
     DASSERT(hCursor);
 
-    AwtCursor::setPData(self, ptr_to_jlong(new AwtCursor(env, hCursor, self, xHotSpot,
-                                              yHotSpot, nW, nH, nSS, cols,
-                                              (BYTE *)andMaskPtr)));
+    try {
+        AwtCursor::setPData(self, ptr_to_jlong(new AwtCursor(env, hCursor, self, xHotSpot,
+                                                             yHotSpot, nW, nH, nSS, cols,
+                                                             (BYTE *)andMaskPtr)));
+    } catch (...) {
+        if (cols) {
+            delete[] cols;
+        }
+        throw;
+    }
     CATCH_BAD_ALLOC;
 }
 
diff --git a/jdk/src/windows/native/sun/windows/awt_Font.cpp b/jdk/src/windows/native/sun/windows/awt_Font.cpp
index 185514c..d0d31ff 100644
--- a/jdk/src/windows/native/sun/windows/awt_Font.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Font.cpp
@@ -510,6 +510,11 @@
     jobject font = env->GetObjectField(fontMetrics, AwtFont::fontID);
     AwtFont* awtFont = AwtFont::GetFont(env, font);
 
+    if (!awtFont) {
+        /* failed to get font */
+        return;
+    }
+
     HDC hDC = ::GetDC(0);
     DASSERT(hDC != NULL);