diff options
author | marha <marha@users.sourceforge.net> | 2009-12-08 11:23:34 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-12-08 11:23:34 +0000 |
commit | 75d2bbcf0f39b9c85bc270728343f61dabebce2d (patch) | |
tree | cc3c92e0383bc1ed885d25290167c46b1f9edb15 /xorg-server/hw/xquartz/xpr | |
parent | 3e1ba549192a68801232c28a9c12defb59531654 (diff) | |
download | vcxsrv-75d2bbcf0f39b9c85bc270728343f61dabebce2d.tar.gz vcxsrv-75d2bbcf0f39b9c85bc270728343f61dabebce2d.tar.bz2 vcxsrv-75d2bbcf0f39b9c85bc270728343f61dabebce2d.zip |
Git update 8/12/2009
Diffstat (limited to 'xorg-server/hw/xquartz/xpr')
-rw-r--r-- | xorg-server/hw/xquartz/xpr/x-hook.c | 12 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/xpr/xprCursor.c | 13 |
2 files changed, 20 insertions, 5 deletions
diff --git a/xorg-server/hw/xquartz/xpr/x-hook.c b/xorg-server/hw/xquartz/xpr/x-hook.c index bb873bbfb..03e7f8553 100644 --- a/xorg-server/hw/xquartz/xpr/x-hook.c +++ b/xorg-server/hw/xquartz/xpr/x-hook.c @@ -34,6 +34,7 @@ #include "x-hook.h" #include <stdlib.h> #include <assert.h> +#include "os.h" #define CELL_NEW(f,d) X_PFX (list_prepend) ((x_list *) (f), (d)) #define CELL_FREE(c) X_PFX (list_free_1) (c) @@ -79,9 +80,13 @@ X_PFX (hook_run) (x_list *lst, void *arg) int length, i; length = X_PFX (list_length) (lst); - fun = alloca (sizeof (x_hook_function *) * length); - data = alloca (sizeof (void *) * length); + fun = xalloc (sizeof (x_hook_function *) * length); + data = xalloc (sizeof (void *) * length); + if(!fun || !data) { + FatalError("Failed to allocate memory in %s\n", __func__); + } + for (i = 0, node = lst; node != NULL; node = node->next, i++) { cell = node->data; @@ -93,6 +98,9 @@ X_PFX (hook_run) (x_list *lst, void *arg) { (*fun[i]) (arg, data[i]); } + + xfree(fun); + xfree(data); } X_EXTERN void diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c index b577fc099..fbaf825de 100644 --- a/xorg-server/hw/xquartz/xpr/xprCursor.c +++ b/xorg-server/hw/xquartz/xpr/xprCursor.c @@ -95,7 +95,10 @@ load_cursor(CursorPtr src, int screen) const uint32_t *be_data=(uint32_t *) src->bits->argb; unsigned i; rowbytes = src->bits->width * sizeof (CARD32); - data=alloca (rowbytes * src->bits->height); + data = xalloc(rowbytes * src->bits->height); + if(!data) { + FatalError("Failed to allocate memory in %s\n", __func__); + } for(i=0;i<(src->bits->width*src->bits->height);i++) data[i]=ntohl(be_data[i]); #endif @@ -118,8 +121,11 @@ load_cursor(CursorPtr src, int screen) /* round up to 8 pixel boundary so we can convert whole bytes */ rowbytes = ((src->bits->width * 4) + 31) & ~31; - data = alloca(rowbytes * src->bits->height); - + data = xalloc(rowbytes * src->bits->height); + if(!data) { + FatalError("Failed to allocate memory in %s\n", __func__); + } + if (!src->bits->emptyMask) { ycount = src->bits->height; @@ -168,6 +174,7 @@ load_cursor(CursorPtr src, int screen) } err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes); + xfree(data); return err == Success; } |