changeset 5922:2c71b4f2104b

8007929: Improve CurvesAlloc Reviewed-by: bae, prr Contributed-by: jia-hong.chen@oracle.com
author bae
date Thu, 21 Mar 2013 12:02:04 +0400
parents 4047e9efcbd0
children 0a3f502b1026
files src/share/native/sun/java2d/cmm/lcms/cmsopt.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/java2d/cmm/lcms/cmsopt.c	Thu Mar 21 11:52:10 2013 +0400
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsopt.c	Thu Mar 21 12:02:04 2013 +0400
@@ -1201,6 +1201,15 @@
     for (i=0; i < nCurves; i++) {
 
         c16->Curves[i] = _cmsCalloc(ContextID, nElements, sizeof(cmsUInt16Number));
+        if (c16->Curves[i] == NULL) {
+            for (j=0; j < i; j++) {
+                _cmsFree(ContextID, c16->Curves[j]);
+            }
+            _cmsFree(ContextID, c16->Curves);
+            _cmsFree(ContextID, c16);
+
+            return NULL;
+        }
 
         if (nElements == 256) {