Fix build on 4.x [1], don't crash with malloc debug flag J enabled [2]

Reported by: 	Tod McQuillin <devin@spamcop.net> [1],
		Doug White <dwhite@gumbysoft.com> [2]
Submitted by:	Tod McQuillin <devin@spamcop.net> [1]
PR:		ports/82994 [1]
This commit is contained in:
Michael Nottebrock 2005-07-05 15:01:17 +00:00
parent 397d9fa708
commit 3c5832c98e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=138513
2 changed files with 29 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= kompmgr
PORTVERSION= ${KDE_VERSION}
PORTREVISION= 1
CATEGORIES= x11-wm kde
MASTER_SITES= ${MASTER_SITE_KDE}
MASTER_SITE_SUBDIR= stable/${PORTVERSION:S/.0//}/src

View File

@ -0,0 +1,28 @@
--- kwin/kompmgr/kompmgr.c.orig Tue Jul 5 16:23:25 2005
+++ kwin/kompmgr/kompmgr.c Tue Jul 5 16:25:43 2005
@@ -1807,6 +1807,7 @@
{
win *new = malloc (sizeof (win));
win **p;
+ unsigned int tmp;
if (!new)
return;
@@ -1867,7 +1868,7 @@
new->shadowSize = get_shadow_prop (dpy, new);
new->shapable = get_shapable_prop(dpy, new);
new->titleHeight = get_titleHeight_prop(dpy, new);
- unsigned int tmp = get_dim_prop(dpy, new);
+ tmp = get_dim_prop(dpy, new);
new->dimPicture = (tmp < OPAQUE) ? solid_picture (dpy, True, (double)tmp/OPAQUE, 0.1, 0.1, 0.1) : None;
new->windowType = determine_wintype (dpy, new->id);
determine_mode (dpy, new);
@@ -2411,7 +2411,7 @@
const char *home = getenv("HOME");
const char *configfile = "/.xcompmgrrc";
wasNull = True;
- filename = (char*)malloc((strlen(home)+strlen(configfile)+1)*sizeof(char));
+ filename = (char*)calloc((strlen(home)+strlen(configfile)+1), sizeof(char));
strcat(filename, home);
strcat(filename, configfile);