diff --git a/MagickCore/artifact.c b/MagickCore/artifact.c
index 59ca6de..ded06db 100644
--- a/MagickCore/artifact.c
+++ b/MagickCore/artifact.c
@@ -112,8 +112,12 @@
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
clone_image->filename);
if (clone_image->artifacts != (void *) NULL)
- image->artifacts=CloneSplayTree((SplayTreeInfo *) clone_image->artifacts,
- (void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
+ {
+ if (image->artifacts != (void *) NULL)
+ DestroyImageArtifacts(image);
+ image->artifacts=CloneSplayTree((SplayTreeInfo *) clone_image->artifacts,
+ (void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
+ }
return(MagickTrue);
}
diff --git a/MagickCore/profile.c b/MagickCore/profile.c
index 1c81f61..0b92355 100644
--- a/MagickCore/profile.c
+++ b/MagickCore/profile.c
@@ -163,8 +163,12 @@
assert(clone_image != (const Image *) NULL);
assert(clone_image->signature == MagickSignature);
if (clone_image->profiles != (void *) NULL)
- image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles,
- (void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo);
+ {
+ if (image->profiles != (void *) NULL)
+ DestroyImageProfiles(image);
+ image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles,
+ (void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo);
+ }
return(MagickTrue);
}