about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY3
-rw-r--r--lib/libppmcolor.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index ae10c634..b4da4c58 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -10,6 +10,9 @@ not yet  BJH  Release 10.80.00
               contrast images (i.e. little difference between foreground and
               background).
 
+              libnetpbm: ppm_readcolordict: Improve error message when there is
+              a problem reading the color dictionary.  Affects ppmhist.
+
               pgmmake: Fix bug: treats non-numeric gray-level argument as zero.
               Always broken (Pgmmake was new in Netpbm 10.32, February 2006).
 
diff --git a/lib/libppmcolor.c b/lib/libppmcolor.c
index 9a1ee5c1..3378e076 100644
--- a/lib/libppmcolor.c
+++ b/lib/libppmcolor.c
@@ -539,15 +539,14 @@ openColornameFile(const char *  const fileName,
 
     if (setjmp(jmpbuf) != 0) {
         pm_asprintf(errorP, "Failed to open color name file");
-        pm_setjmpbuf(origJmpbufP);
-        pm_longjmp();
     } else {
+        pm_setjmpbufsave(&jmpbuf, &origJmpbufP);
+
         *filePP = pm_openColornameFile(fileName, mustOpen);
 
         *errorP = NULL;  /* Would have longjmped if there were a problem */
-
-        pm_setjmpbuf(origJmpbufP);
     }
+    pm_setjmpbuf(origJmpbufP);
 }
 
 
@@ -733,7 +732,7 @@ ppm_readcolordict(const char *      const fileName,
     if (error) {
         pm_errormsg("%s", error);
         pm_strfree(error);
-        ppm_freecolorhash(cht);
+        pm_longjmp();
     } else {
         if (chtP)
             *chtP = cht;