Blame SOURCES/ghostscript-9.54.0-gdevtxtw-null-also-pointers.patch

f226a6
diff --git a/devices/vector/gdevtxtw.c b/devices/vector/gdevtxtw.c
f226a6
index c6b95ed5b..f103d598b 100644
f226a6
--- a/devices/vector/gdevtxtw.c
f226a6
+++ b/devices/vector/gdevtxtw.c
f226a6
@@ -1982,16 +1982,26 @@ textw_text_release(gs_text_enum_t *pte, client_name_t cname)
f226a6
     gx_device_txtwrite_t *const tdev = (gx_device_txtwrite_t *) pte->dev;
f226a6
 
f226a6
     /* Free the working buffer where the Unicode was assembled from the enumerated text */
f226a6
-    if (penum->TextBuffer)
f226a6
+    if (penum->TextBuffer) {
f226a6
         gs_free(tdev->memory, penum->TextBuffer, 1, penum->TextBufferIndex, "txtwrite free temporary text buffer");
f226a6
-    if (penum->Widths)
f226a6
+        penum->TextBuffer = NULL;
f226a6
+    }
f226a6
+    if (penum->Widths) {
f226a6
         gs_free(tdev->memory, penum->Widths, sizeof(float), pte->text.size, "txtwrite free temporary widths array");
f226a6
-    if (penum->Advs)
f226a6
+        penum->Widths = NULL;
f226a6
+    }
f226a6
+    if (penum->Advs) {
f226a6
         gs_free(tdev->memory, penum->Advs, 1, penum->TextBufferIndex, "txtwrite free temporary text buffer");
f226a6
-    if (penum->GlyphWidths)
f226a6
+        penum->Advs = NULL;
f226a6
+    }
f226a6
+    if (penum->GlyphWidths) {
f226a6
         gs_free(tdev->memory, penum->GlyphWidths, 1, penum->TextBufferIndex, "txtwrite free temporary text buffer");
f226a6
-    if (penum->SpanDeltaX)
f226a6
+        penum->GlyphWidths = NULL;
f226a6
+    }
f226a6
+    if (penum->SpanDeltaX) {
f226a6
         gs_free(tdev->memory, penum->SpanDeltaX, 1, penum->TextBufferIndex, "txtwrite free temporary text buffer");
f226a6
+        penum->SpanDeltaX = NULL;
f226a6
+    }
f226a6
     /* If this is copied away when we complete the text enumeration succesfully, then
f226a6
      * we set the pointer to NULL, if we get here with it non-NULL , then there was
f226a6
      * an error.
f226a6
@@ -2008,6 +2018,7 @@ textw_text_release(gs_text_enum_t *pte, client_name_t cname)
f226a6
         if (penum->text_state->FontName)
f226a6
             gs_free(tdev->memory, penum->text_state->FontName, 1, penum->TextBufferIndex, "txtwrite free temporary font name copy");
f226a6
         gs_free(tdev->memory, penum->text_state, 1, sizeof(penum->text_state), "txtwrite free text state");
f226a6
+        penum->text_state = NULL;
f226a6
     }
f226a6
 }
f226a6
 
f226a6
-- 
f226a6
2.17.1