aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/utils.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-10-05 06:01:27 +0000
committermarha <marha@users.sourceforge.net>2010-10-05 06:01:27 +0000
commitf07afca523ad174acd3c56fc43111a09b7a5243e (patch)
tree382a0fd5893fda6a557e876942c23e3517fdfea0 /pixman/test/utils.c
parentb65b8f8f5f9d2ffcf9dd6419f0c582d14986a9e0 (diff)
downloadvcxsrv-f07afca523ad174acd3c56fc43111a09b7a5243e.tar.gz
vcxsrv-f07afca523ad174acd3c56fc43111a09b7a5243e.tar.bz2
vcxsrv-f07afca523ad174acd3c56fc43111a09b7a5243e.zip
xserver pixman git update 5/10/2010
Diffstat (limited to 'pixman/test/utils.c')
-rw-r--r--pixman/test/utils.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/pixman/test/utils.c b/pixman/test/utils.c
index d7038a36e..acf494938 100644
--- a/pixman/test/utils.c
+++ b/pixman/test/utils.c
@@ -243,7 +243,7 @@ fence_malloc (uint32_t len)
addr = mmap (NULL, n_bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
- if (addr == (void *)MAP_FAILED)
+ if (addr == MAP_FAILED)
{
printf ("mmap failed on %u %u\n", len, n_bytes);
return NULL;
@@ -259,20 +259,12 @@ fence_malloc (uint32_t len)
((info_t *)initial_page)->trailing = trailing_protected;
((info_t *)initial_page)->n_bytes = n_bytes;
- if (mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
- PROT_NONE) == -1)
+ if ((mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
+ PROT_NONE) == -1) ||
+ (mprotect (trailing_protected, N_TRAILING_PROTECTED * page_size,
+ PROT_NONE) == -1))
{
- free (addr);
- return NULL;
- }
-
- if (mprotect (trailing_protected, N_TRAILING_PROTECTED * page_size,
- PROT_NONE) == -1)
- {
- mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
- PROT_READ | PROT_WRITE);
-
- free (addr);
+ munmap (addr, n_bytes);
return NULL;
}
@@ -287,13 +279,6 @@ fence_free (void *data)
uint8_t *leading_protected = payload - N_LEADING_PROTECTED * page_size;
uint8_t *initial_page = leading_protected - page_size;
info_t *info = (info_t *)initial_page;
- uint8_t *trailing_protected = info->trailing;
-
- mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
- PROT_READ | PROT_WRITE);
-
- mprotect (trailing_protected, N_LEADING_PROTECTED * page_size,
- PROT_READ | PROT_WRITE);
munmap (info->addr, info->n_bytes);
}