From 24a692ce832161d3b794110dd82b1508d38a0887 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 12 Sep 2011 08:58:44 +0200 Subject: git update 12 sep 2011 --- mesalib/src/mesa/main/extensions.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mesalib/src/mesa/main/extensions.c') 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; -- cgit v1.2.3