mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-14 12:12:26 +00:00
dtwm: fix a segfault.
This commit is contained in:
parent
760d36bfe9
commit
b979a073df
1 changed files with 7 additions and 4 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "WmICCC.h"
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <Dt/WsmP.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <Xm/AtomMgr.h>
|
||||
|
@ -1954,18 +1955,20 @@ void UpdateNetWmState (Window window, Atom *states, unsigned long nstates,
|
|||
{
|
||||
int i, j, actualFormat;
|
||||
unsigned long nold, leftover;
|
||||
Atom actualType, *oldStates, *newStates;
|
||||
Atom actualType;
|
||||
unsigned long nnew = 0;
|
||||
Atom type = wmGD.xa__NET_WM_STATE;
|
||||
Atom *oldStates = NULL;
|
||||
Atom *newStates = NULL;
|
||||
|
||||
if (!states) nstates = 0;
|
||||
|
||||
if (!(XGetWindowProperty (DISPLAY, window, type, 0L, 1000000L, False,
|
||||
XA_ATOM, &actualType, &actualFormat, &nold,
|
||||
&leftover, (unsigned char **) &oldStates)
|
||||
== Success && actualType == XA_ATOM)) nold = 0;
|
||||
|
||||
if (!(states && nstates) && nold) goto done;
|
||||
|
||||
newStates = malloc ((nstates + nold) * sizeof (Atom));
|
||||
newStates = malloc ((1 + nstates + nold) * sizeof (Atom));
|
||||
|
||||
if (!newStates) goto done;
|
||||
|
||||
|
|
Loading…
Reference in a new issue