fix g_null_pointer memleak

fixes for compiles on NetBSD & FreeBSD


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@575 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2004-01-22 20:31:59 +00:00
parent d1e409f1f6
commit 628db36a74
3 changed files with 13 additions and 13 deletions

2
disk.c
View File

@ -88,7 +88,7 @@
#define STATFS_T statvfs
#define F_NAMELEN(buf) ((buf).f_namemax)
#elif defined(__OpenBSD__)
#elif (defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__))
#include <sys/param.h>
#include <sys/mount.h>
#define STATFS_FN(path, buf) (statfs(path,buf))

View File

@ -1,4 +1,6 @@
#include <unistd.h>
#include <sys/types.h>
#include <time.h>
#include "rdesktop.h"
#define IRP_MJ_CREATE 0x00

22
xwin.c
View File

@ -42,8 +42,7 @@ static int g_x_socket;
static Screen *g_screen;
Window g_wnd;
BOOL g_enable_compose = False;
static GC g_gc;
static BOOL g_gc_initialized = False;
static GC g_gc = NULL;
static Visual *g_visual;
static int g_depth;
static int g_bpp;
@ -51,7 +50,7 @@ static XIM g_IM;
static XIC g_IC;
static XModifierKeymap *g_mod_map;
static Cursor g_current_cursor;
static HCURSOR g_null_cursor;
static HCURSOR g_null_cursor = NULL;
static Atom g_protocol_atom, g_kill_atom;
static BOOL g_focused;
static BOOL g_mouse_in_wnd;
@ -64,8 +63,7 @@ static int g_red_shift_l, g_blue_shift_l, g_green_shift_l;
/* software backing store */
static BOOL g_ownbackstore;
static Pixmap g_backstore;
static BOOL g_backstore_initialized = False;
static Pixmap g_backstore = NULL;
/* Moving in single app mode */
static BOOL g_moving_wnd;
@ -851,6 +849,9 @@ ui_deinit(void)
{
if (g_IM != NULL)
XCloseIM(g_IM);
if (g_null_cursor != NULL)
ui_destroy_cursor(g_null_cursor);
XFreeModifiermap(g_mod_map);
@ -888,13 +889,10 @@ ui_create_window(void)
CWBackPixel | CWBackingStore | CWOverrideRedirect |
CWColormap | CWBorderPixel, &attribs);
if ( ! g_gc_initialized )
{
if (g_gc == NULL)
g_gc = XCreateGC(g_display, g_wnd, 0, NULL);
g_gc_initialized = True;
}
if ((g_ownbackstore) && (! g_backstore_initialized))
if ((g_ownbackstore) && (g_backstore == NULL))
{
g_backstore =
XCreatePixmap(g_display, g_wnd, g_width, g_height,
@ -903,7 +901,6 @@ ui_create_window(void)
/* clear to prevent rubbish being exposed at startup */
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));
XFillRectangle(g_display, g_backstore, g_gc, 0, 0, g_width, g_height);
g_backstore_initialized = True;
}
XStoreName(g_display, g_wnd, g_title);
@ -970,7 +967,8 @@ ui_create_window(void)
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1);
/* create invisible 1x1 cursor to be used as null cursor */
g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data);
if (g_null_cursor == NULL)
g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data);
return True;
}