harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r476162 - /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/NativeCMM.c
Date Fri, 17 Nov 2006 14:51:13 GMT
Author: varlax
Date: Fri Nov 17 06:51:08 2006
New Revision: 476162

URL: http://svn.apache.org/viewvc?view=rev&rev=476162
Log:
Applied HARMONY-2100 [classlib] java.awt.color.ICC_ProfileRTest fails

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/NativeCMM.c

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/NativeCMM.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/NativeCMM.c?view=diff&rev=476162&r1=476161&r2=476162
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/NativeCMM.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/NativeCMM.c
Fri Nov 17 06:51:08 2006
@@ -27,7 +27,7 @@
 
 int gl_cmsErrorHandler(int errorCode, const char *msg) {
   if(errorCode == LCMS_ERRC_ABORTED) {
-    errMsg = msg; // Throw exception later, after returning control from cmm
+    errMsg = strdup(msg); // Throw exception later, after returning control from cmm
   }
 
   return 1;
@@ -56,8 +56,11 @@
 
     (*env)->ReleaseByteArrayElements (env, data, byteData, 0);
 
-    if(hProfile == NULL)
+    if(hProfile == NULL) {
         newCMMException(env, errMsg); // Throw java exception if error occured
+        free(errMsg);
+        errMsg = NULL;
+    }
 
   // Return obtained handle
   return (jlong) ((IDATA)hProfile);
@@ -73,8 +76,11 @@
 {
   cmsHPROFILE hProfile = (cmsHPROFILE) ((IDATA)profileID);
 
-    if(!cmsCloseProfile(hProfile))
+    if(!cmsCloseProfile(hProfile)) {
         newCMMException(env, errMsg); // Throw java exception if error occured
+        free(errMsg);
+        errMsg = NULL;
+    }        
 }
 
 /*
@@ -125,11 +131,17 @@
 
 
   if(ts == HEADER_TAG_ID) {
-        if(!cmmGetProfileHeader(hProfile, byteData, dataSize))
+        if(!cmmGetProfileHeader(hProfile, byteData, dataSize)) {
             newCMMException(env, errMsg); // Throw java exception if error occured
+            free(errMsg);
+            errMsg = NULL;
+        }
     } else {
-        if(!cmmGetProfileElement(hProfile, ts, byteData, &dataSize))
+        if(!cmmGetProfileElement(hProfile, ts, byteData, &dataSize)) {
             newCMMException(env, errMsg); // Throw java exception if error occured
+            free(errMsg);
+            errMsg = NULL;
+        }
     }
 
     (*env)->ReleaseByteArrayElements (env, data, byteData, 0);
@@ -181,8 +193,11 @@
             newCMMException(env, "Invalid header data"); // Throw java exception if error
occured
 
     } else {
-      if(!cmmSetProfileElement(hProfile, ts, byteData, dataSize))
+      if(!cmmSetProfileElement(hProfile, ts, byteData, dataSize)) {
             newCMMException(env, errMsg); // Throw java exception if error occured
+            free(errMsg);
+            errMsg = NULL;
+      }
     }
 
     (*env)->ReleaseByteArrayElements (env, data, byteData, 0);



Mime
View raw message