< prev index next >

src/java.desktop/share/native/liblcms/cmsnamed.c

Print this page

        

@@ -28,11 +28,11 @@
 // file:
 //
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
 // to deal in the Software without restriction, including without limitation
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,

@@ -565,11 +565,11 @@
     v ->nColors   = 0;
     v ->ContextID  = ContextID;
 
     while (v -> Allocated < n) {
         if (!GrowNamedColorList(v)) {
-            _cmsFree(ContextID, (void*) v);
+            cmsFreeNamedColorList(v);
             return NULL;
         }
     }
 
     strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1);

@@ -598,11 +598,15 @@
     NewNC= cmsAllocNamedColorList(v ->ContextID, v -> nColors, v ->ColorantCount, v ->Prefix, v ->Suffix);
     if (NewNC == NULL) return NULL;
 
     // For really large tables we need this
     while (NewNC ->Allocated < v ->Allocated){
-        if (!GrowNamedColorList(NewNC)) return NULL;
+        if (!GrowNamedColorList(NewNC))
+        {
+            cmsFreeNamedColorList(NewNC);
+            return NULL;
+        }
     }
 
     memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix));
     memmove(NewNC ->Suffix, v ->Suffix, sizeof(v ->Suffix));
     NewNC ->ColorantCount = v ->ColorantCount;
< prev index next >