diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2019-10-31 14:17:38 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2019-10-31 14:20:15 +0000 |
commit | 0d998f17c495a12b04904113ff676c7427089883 (patch) | |
tree | 4aa3a8e44055079e27bd9530e98f5abcd9aabb25 /contrib | |
parent | 714e8995cd582d418276915cbbec3c70711fb19e (diff) | |
download | ghostpdl-0d998f17c495a12b04904113ff676c7427089883.tar.gz |
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.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/eplaser/gdevescv.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/contrib/eplaser/gdevescv.c b/contrib/eplaser/gdevescv.c index a13afef0b..7044eb7d2 100644 --- a/contrib/eplaser/gdevescv.c +++ b/contrib/eplaser/gdevescv.c @@ -33,9 +33,17 @@ */ +#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 <string.h> #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; } } |