aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/extensions.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-12 08:58:44 +0200
committermarha <marha@users.sourceforge.net>2011-09-12 08:58:44 +0200
commit24a692ce832161d3b794110dd82b1508d38a0887 (patch)
tree388d2fd8dc707763d6ffea7edfa2a6a1410c7c5e /mesalib/src/mesa/main/extensions.c
parentf9cf11136d65f20aab4fb6d5fc3ec3c59185a0b4 (diff)
downloadvcxsrv-24a692ce832161d3b794110dd82b1508d38a0887.tar.gz
vcxsrv-24a692ce832161d3b794110dd82b1508d38a0887.tar.bz2
vcxsrv-24a692ce832161d3b794110dd82b1508d38a0887.zip
git update 12 sep 2011
Diffstat (limited to 'mesalib/src/mesa/main/extensions.c')
-rw-r--r--mesalib/src/mesa/main/extensions.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 1903a503c..9cec15b58 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -37,6 +37,8 @@
#include "mfeatures.h"
#include "mtypes.h"
+#define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
+
enum {
DISABLE = 0,
GL = 1 << API_OPENGL,
@@ -769,11 +771,11 @@ get_extension_override( struct gl_context *ctx )
if (env_const == NULL) {
/* Return the empty string rather than NULL. This simplifies the logic
* of client functions. */
- return calloc(1, sizeof(char));
+ return calloc(4, sizeof(char));
}
/* extra_exts: List of unrecognized extensions. */
- extra_exts = calloc(strlen(env_const), sizeof(char));
+ extra_exts = calloc(ALIGN(strlen(env_const) + 2, 4), sizeof(char));
/* Copy env_const because strtok() is destructive. */
env = strdup(env_const);
@@ -907,7 +909,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
if (extra_extensions != NULL)
length += 1 + strlen(extra_extensions); /* +1 for space */
- exts = (char *) calloc(length + 1, sizeof(char));
+ exts = (char *) calloc(ALIGN(length + 1, 4), sizeof(char));
if (exts == NULL) {
free(extra_extensions);
return NULL;