--- a/filter.c
+++ b/filter.c
@@ -1043,17 +1043,26 @@
         metadata->iccProfile.size = 0;
     }
 
-    if (metadata->copyright!=NULL) 
+    if (metadata->copyright!=NULL)  {
         free(metadata->copyright);
-
-    if (metadata->artist!=NULL) 
+	metadata->copyright = NULL;
+    }
+    
+
+    if (metadata->artist!=NULL) {
         free(metadata->artist);
-
-    if (metadata->datetime!=NULL) 
-        free(metadata->datetime);
-
-    if (metadata->imageDescription!=NULL) 
+	metadata->artist = NULL;
+    }
+
+    if (metadata->datetime!=NULL)  {
+	free(metadata->datetime);
+	metadata->datetime = NULL;
+    }
+
+    if (metadata->imageDescription!=NULL)  {
         free(metadata->imageDescription);
+        metadata->imageDescription = NULL;
+    }
     
 }