Skip to content
This repository
tree: ea3426bf53
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 50 lines (45 sloc) 1.414 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
From 30e224200d5234f137a0b51c2f1253cc38c4e4b4 Mon Sep 17 00:00:00 2001
From: Eeri Kask <EKask@web.de>
Date: Fri, 16 Dec 2011 22:42:09 +0100
Subject: [PATCH 042/124] FixCreateColormapWindows

Signed-off-by: Eeri Kask <EKask@web.de>
---
 src/add_window.c | 25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/add_window.c b/src/add_window.c
index 3ede505..afd2e1c 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -1555,16 +1555,21 @@ FetchWmColormapWindows (TwmWindow *tmp)
     /* No else here, in case we bailed out of clause above.
      */
     if (number_cmap_windows == 0) {
-
- number_cmap_windows = 1;
-
- cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *));
- if (XFindContext(dpy, tmp->w, ColormapContext, (caddr_t *)&cwins[0]) ==
- XCNOENT)
- cwins[0] = CreateColormapWindow(tmp->w,
- (Bool) tmp->cmaps.number_cwins == 0, False);
- else
- cwins[0]->refcnt++;
+ cwins = (ColormapWindow **) calloc(1, sizeof(ColormapWindow *));
+ if (cwins) {
+ if (XFindContext(dpy, tmp->w, ColormapContext, (caddr_t *)&cwins[0]) ==
+ XCNOENT)
+ cwins[0] = CreateColormapWindow(tmp->w,
+ (Bool) tmp->cmaps.number_cwins == 0, False);
+ else
+ cwins[0]->refcnt++;
+ if (cwins[0])
+ number_cmap_windows = 1;
+ else {
+ free (cwins);
+ cwins = NULL;
+ }
+ }
     }
 
     if (tmp->cmaps.number_cwins)
--
1.7.3.4

Something went wrong with that request. Please try again.