mirror of
https://git.freebsd.org/ports.git
synced 2025-05-25 15:36:35 -04:00
acm may coredump immediately after starting on systems which do not zero malloc()ed memory e.g., MALLOC_CONF=junk:true. This is because one of the fields of a malloc()ed data structure (w) contains a pointer (w->csPool2), and if that pointer is never used, then later code will find the pointer is non-NULL and try to free() the memory pointed to by the pointer. PR: 215427 Submitted by: Jeff Gibbons <jgibbons@protogate.com>
16 lines
616 B
C
16 lines
616 B
C
--- V/lib/InitAWin.c.orig 1998-08-14 21:09:02 UTC
|
|
+++ V/lib/InitAWin.c
|
|
@@ -69,6 +69,13 @@ InitializeX11AWindow(Display * dpy, int screen, Drawab
|
|
w->csPool1 = (ColorSegment *) malloc(w->CSSize1 * sizeof(ColorSegment));
|
|
memset(w->csPool1, 0, w->CSSize1 * sizeof(ColorSegment));
|
|
|
|
+ // Initialize csPool2 so program doesn't crash later,
|
|
+ // when trying to free it.
|
|
+ {
|
|
+ w->CSSize2 = 0;
|
|
+ w->csPool2 = (ColorSegment *) NULL;
|
|
+ }
|
|
+
|
|
w->scanLine = (ScanLine *) malloc((w->height + 1) * sizeof(ScanLine));
|
|
w->lastScanLine = (ScanLine *) malloc((w->height + 1) * sizeof(ScanLine));
|
|
w->otherLastScanLine = NULL;
|