diff --git a/coders/cmyk.c b/coders/cmyk.c
index a20ec2d..78989b0 100644
--- a/coders/cmyk.c
+++ b/coders/cmyk.c
@@ -1080,8 +1080,8 @@
       }
     scene++;
   } while (count == (ssize_t) length);
-  InheritException(exception,&image->exception);
   quantum_info=DestroyQuantumInfo(quantum_info);
+  InheritException(&image->exception,&canvas_image->exception);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
diff --git a/coders/gray.c b/coders/gray.c
index 110f026..a3e9139 100644
--- a/coders/gray.c
+++ b/coders/gray.c
@@ -276,7 +276,7 @@
     scene++;
   } while (count == (ssize_t) length);
   quantum_info=DestroyQuantumInfo(quantum_info);
-  InheritException(exception,&canvas_image->exception);
+  InheritException(&image->exception,&canvas_image->exception);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
diff --git a/coders/raw.c b/coders/raw.c
index 406ccc0..dfa92f4 100644
--- a/coders/raw.c
+++ b/coders/raw.c
@@ -274,7 +274,7 @@
     scene++;
   } while (count == (ssize_t) length);
   quantum_info=DestroyQuantumInfo(quantum_info);
-  InheritException(exception,&canvas_image->exception);
+  InheritException(&image->exception,&canvas_image->exception);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
diff --git a/coders/rgb.c b/coders/rgb.c
index b062f09..47b1a52 100644
--- a/coders/rgb.c
+++ b/coders/rgb.c
@@ -595,8 +595,8 @@
       }
     scene++;
   } while (count == (ssize_t) length);
-  InheritException(exception,&image->exception);
   quantum_info=DestroyQuantumInfo(quantum_info);
+  InheritException(&image->exception,&canvas_image->exception);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
diff --git a/coders/ycbcr.c b/coders/ycbcr.c
index 2546eab..1a29b7d 100644
--- a/coders/ycbcr.c
+++ b/coders/ycbcr.c
@@ -838,8 +838,8 @@
       }
     scene++;
   } while (count == (ssize_t) length);
-  InheritException(exception,&image->exception);
   quantum_info=DestroyQuantumInfo(quantum_info);
+  InheritException(&image->exception,&canvas_image->exception);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));