[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1780-g0d998f1

[email protected] (Robin Watts) Thu, 31 Oct 2019 14:20:30 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  0d998f17c495a12b04904113ff676c7427089883 (commit)
      from  714e8995cd582d418276915cbbec3c70711fb19e (commit)

----------------------------------------------------------------------
commit 0d998f17c495a12b04904113ff676c7427089883
Author: Robin Watts <[email protected]>
Date:   Thu Oct 31 14:17:38 2019 +0000

    Fix gdevescv for operation with Memento.
    
    Blocks returned by system malloc can't be freed by Memento_free.
    
    Also, avoid a problem in CLUSTER builds.

diff --git a/contrib/eplaser/gdevescv.c b/contrib/eplaser/gdevescv.c
index a13afef..7044eb7 100644
--- a/contrib/eplaser/gdevescv.c
+++ b/contrib/eplaser/gdevescv.c
@@ -33,9 +33,17 @@
 
  */
 
-#if ( 6 > GS_VERSION_MAJOR )
-
 #include <string.h>
+
+/* Get this definition in before we read memento.h */
+static void
+unvectored_free(void *x)
+{
+  free(x);
+}
+
+#if ( 6 > GS_VERSION_MAJOR )
+
 #include <sys/utsname.h>	/* for uname(2) */
 #include <ctype.h>		/* for toupper(3) */
 
@@ -983,10 +991,12 @@ escv_beginpage(gx_device_vector * vdev)
 
 #ifdef CLUSTER
         memset(&tm, 0, sizeof(tm));
+        strcpy(str, "1970/01/01 00:00:00");
+        i = strlen(str);
 #else
         tm =  localtime( &t );
-#endif
         i = strftime(str, 30, "%Y/%m/%d %H:%M:%S", tm);
+#endif
         if ( 30 >= i )
           str[i] = '\0';
 
@@ -1022,7 +1032,8 @@ escv_beginpage(gx_device_vector * vdev)
       if (sysname)
         {
           lputs(s, sysname );
-          free (sysname);
+          /* Carefully avoid memento interfering here. */
+          unvectored_free(sysname);
           sysname = NULL;
         }
     }


Summary of changes:
 contrib/eplaser/gdevescv.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)