Replace _mesa_malloc, _mesa_calloc and _mesa_free with plain libc versions
diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c
index ca6821d..6a8bf89 100644
--- a/src/egl/drivers/dri/egldri.c
+++ b/src/egl/drivers/dri/egldri.c
@@ -812,7 +812,7 @@
         return GL_FALSE;
     }
 
-    cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t));
+    cliprect = (drm_clip_rect_t*) malloc(sizeof(drm_clip_rect_t));
     cliprect->x1 = drawable->x;
     cliprect->y1 = drawable->y;
     cliprect->x2 = drawable->x + drawable->w;
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 9093a0e..0932569 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -1018,7 +1018,7 @@
    xmvis = choose_visual(dpy, screen, list, GL_FALSE);
    if (xmvis) {
       /* create a new vishandle - the cached one may be stale */
-      xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
+      xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
       if (xmvis->vishandle) {
          memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
       }
@@ -1055,7 +1055,7 @@
       xmvis = create_glx_visual( dpy, visinfo );
       if (!xmvis) {
          /* unusable visual */
-         _mesa_free(glxCtx);
+         free(glxCtx);
          return NULL;
       }
    }
@@ -1063,7 +1063,7 @@
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
    if (!glxCtx->xmesaContext) {
-      _mesa_free(glxCtx);
+      free(glxCtx);
       return NULL;
    }
 
@@ -1336,7 +1336,7 @@
    MakeCurrent_PrevReadBuffer = 0;
    XMesaDestroyContext( glxCtx->xmesaContext );
    XMesaGarbageCollect();
-   _mesa_free(glxCtx);
+   free(glxCtx);
 }
 
 
@@ -1755,7 +1755,7 @@
    visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
    if (*nelements > 0) {
       XMesaVisual *results;
-      results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
+      results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual));
       if (!results) {
          *nelements = 0;
          return NULL;
@@ -1782,7 +1782,7 @@
 
    xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
    if (xmvis) {
-      GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
+      GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual));
       if (!config) {
          *nitems = 0;
          return NULL;
@@ -1807,7 +1807,7 @@
       return xmvis->vishandle;
 #else
       /* create a new vishandle - the cached one may be stale */
-      xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
+      xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
       if (xmvis->vishandle) {
          memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
       }
@@ -2112,7 +2112,7 @@
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
    if (!glxCtx->xmesaContext) {
-      _mesa_free(glxCtx);
+      free(glxCtx);
       return NULL;
    }
 
@@ -2332,7 +2332,7 @@
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
    if (!glxCtx->xmesaContext) {
-      _mesa_free(glxCtx);
+      free(glxCtx);
       return NULL;
    }
 
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 2e678c8..61af663 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -175,7 +175,7 @@
    /* grab the bits/pixel value */
    bitsPerPixel = img->bits_per_pixel;
    /* free the XImage */
-   _mesa_free( img->data );
+   free( img->data );
    img->data = NULL;
    XDestroyImage( img );
    return bitsPerPixel;
@@ -669,13 +669,13 @@
 
    v->display = display;
 
-   /* Save a copy of the XVisualInfo struct because the user may X_mesa_free()
+   /* Save a copy of the XVisualInfo struct because the user may Xfree()
     * the struct but we may need some of the information contained in it
     * at a later time.
     */
    v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
    if (!v->visinfo) {
-      _mesa_free(v);
+      free(v);
       return NULL;
    }
    memcpy(v->visinfo, visinfo, sizeof(*visinfo));
@@ -743,8 +743,8 @@
 PUBLIC
 void XMesaDestroyVisual( XMesaVisual v )
 {
-   _mesa_free(v->visinfo);
-   _mesa_free(v);
+   free(v->visinfo);
+   free(v);
 }
 
 
@@ -811,7 +811,7 @@
    else if (pipe)
       pipe->destroy(pipe);
 
-   _mesa_free(c);
+   free(c);
    return NULL;
 }
 
@@ -828,7 +828,7 @@
    screen->destroy(screen);
    */
 
-   _mesa_free(c);
+   free(c);
 }
 
 
diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c
index 257087a..eb90379 100644
--- a/src/glx/glcontextmodes.c
+++ b/src/glx/glcontextmodes.c
@@ -31,39 +31,13 @@
  * \author Ian Romanick <idr@us.ibm.com>
  */
 
-#if defined(IN_MINI_GLX)
-#include <GL/gl.h>
-#else
-#if defined(HAVE_DIX_CONFIG_H)
-# include <dix-config.h>
-#endif
-#include <X11/X.h>
 #include <GL/glx.h>
 #include "GL/glxint.h"
-#endif
-
-/* Memory macros */
-#if defined(IN_MINI_GLX)
-# include <stdlib.h>
-# include <string.h>
-# define _mesa_malloc(b) malloc(b)
-# define _mesa_free(m) free(m)
-#else
-# ifdef XFree86Server
-# include <os.h>
-# include <string.h>
-#  define _mesa_malloc(b) xalloc(b)
-#  define _mesa_free(m)   xfree(m)
-# else
-#  include <X11/Xlibint.h>
-#  define _mesa_malloc(b) Xmalloc(b)
-#  define _mesa_free(m) Xfree(m)
-# endif /* XFree86Server */
-#endif /* !defined(IN_MINI_GLX) */
+#include <stdlib.h>
+#include <string.h>
 
 #include "glcontextmodes.h"
 
-#if !defined(IN_MINI_GLX)
 #define NUM_VISUAL_TYPES   6
 
 /**
@@ -352,7 +326,6 @@
       return GLX_BAD_ATTRIBUTE;
    }
 }
-#endif /* !defined(IN_MINI_GLX) */
 
 
 /**
@@ -392,7 +365,7 @@
 
    next = &base;
    for (i = 0; i < count; i++) {
-      *next = (__GLcontextModes *) _mesa_malloc(size);
+      *next = (__GLcontextModes *) malloc(size);
       if (*next == NULL) {
          _gl_context_modes_destroy(base);
          base = NULL;
@@ -438,7 +411,7 @@
    while (modes != NULL) {
       __GLcontextModes *const next = modes->next;
 
-      _mesa_free(modes);
+      free(modes);
       modes = next;
    }
 }
diff --git a/src/glx/glcontextmodes.h b/src/glx/glcontextmodes.h
index 6676ae3..ecf0280 100644
--- a/src/glx/glcontextmodes.h
+++ b/src/glx/glcontextmodes.h
@@ -32,14 +32,12 @@
 
 #include "GL/internal/glcore.h"
 
-#if !defined(IN_MINI_GLX)
 extern GLint _gl_convert_from_x_visual_type(int visualType);
 extern GLint _gl_convert_to_x_visual_type(int visualType);
 extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
                                             const __GLXvisualConfig * config);
 extern int _gl_get_context_mode_data(const __GLcontextModes * mode,
                                      int attribute, int *value_return);
-#endif /* !defined(IN_MINI_GLX) */
 
 extern __GLcontextModes *_gl_context_modes_create(unsigned count,
                                                   size_t minimum_size);
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 4dd2293..42ab7d4 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -307,7 +307,7 @@
     * freed by the normal context destruction code.  But this would be
     * the place to free other meta data someday.
     */
-   _mesa_free(ctx->Meta);
+   free(ctx->Meta);
    ctx->Meta = NULL;
 }
 
@@ -1304,7 +1304,7 @@
    }
 
    if (mask & GL_DEPTH_BUFFER_BIT) {
-      GLuint *tmp = (GLuint *) _mesa_malloc(srcW * srcH * sizeof(GLuint));
+      GLuint *tmp = (GLuint *) malloc(srcW * srcH * sizeof(GLuint));
       if (tmp) {
          if (!blit->DepthFP)
             init_blit_depth_pixels(ctx);
@@ -1328,7 +1328,7 @@
          _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
          mask &= ~GL_DEPTH_BUFFER_BIT;
 
-         _mesa_free(tmp);
+         free(tmp);
       }
    }
 
@@ -2065,7 +2065,7 @@
    if (!bitmap1)
       return;
 
-   bitmap8 = (GLubyte *) _mesa_calloc(width * height);
+   bitmap8 = (GLubyte *) calloc(1, width * height);
    if (bitmap8) {
       _mesa_expand_bitmap(width, height, &unpackSave, bitmap1,
                           bitmap8, width, 0xff);
@@ -2082,7 +2082,7 @@
 
       _mesa_set_enable(ctx, tex->Target, GL_FALSE);
 
-      _mesa_free(bitmap8);
+      free(bitmap8);
    }
 
    _mesa_unmap_pbo_source(ctx, &unpackSave);
@@ -2531,7 +2531,7 @@
    /*
     * Alloc image buffer (XXX could use a PBO)
     */
-   buf = _mesa_malloc(width * height * bpp);
+   buf = malloc(width * height * bpp);
    if (!buf) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
       return;
@@ -2592,7 +2592,7 @@
 
    _mesa_lock_texture(ctx, texObj); /* re-lock */
 
-   _mesa_free(buf);
+   free(buf);
 }
 
 
@@ -2647,7 +2647,7 @@
    /*
     * Alloc image buffer (XXX could use a PBO)
     */
-   buf = _mesa_malloc(width * height * bpp);
+   buf = malloc(width * height * bpp);
    if (!buf) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%uD", dims);
       return;
@@ -2688,7 +2688,7 @@
 
    _mesa_lock_texture(ctx, texObj); /* re-lock */
 
-   _mesa_free(buf);
+   free(buf);
 }
 
 
@@ -2731,7 +2731,7 @@
 {
    GLfloat *buf;
 
-   buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
    if (!buf) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorTable");
       return;
@@ -2748,7 +2748,7 @@
 
    _mesa_meta_end(ctx);
 
-   _mesa_free(buf);
+   free(buf);
 }
 
 
@@ -2758,7 +2758,7 @@
 {
    GLfloat *buf;
 
-   buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
    if (!buf) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorSubTable");
       return;
@@ -2775,7 +2775,7 @@
 
    _mesa_meta_end(ctx);
 
-   _mesa_free(buf);
+   free(buf);
 }
 
 
@@ -2786,7 +2786,7 @@
 {
    GLfloat *buf;
 
-   buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
    if (!buf) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
       return;
@@ -2805,7 +2805,7 @@
 
    _mesa_meta_end(ctx);
 
-   _mesa_free(buf);
+   free(buf);
 }
 
 
@@ -2816,7 +2816,7 @@
 {
    GLfloat *buf;
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
    if (!buf) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
       return;
@@ -2836,5 +2836,5 @@
 
    _mesa_meta_end(ctx);
 
-   _mesa_free(buf);
+   free(buf);
 }
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 58a94b5..9142dd7 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -242,12 +242,12 @@
     }
 
     if (pdp->pClipRects) {
-	_mesa_free(pdp->pClipRects); 
+	free(pdp->pClipRects); 
 	pdp->pClipRects = NULL;
     }
 
     if (pdp->pBackClipRects) {
-	_mesa_free(pdp->pBackClipRects); 
+	free(pdp->pBackClipRects); 
 	pdp->pBackClipRects = NULL;
     }
 
@@ -324,7 +324,7 @@
     if (!dPriv->numClipRects)
         return;
 
-    rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
+    rects = malloc(sizeof(*rects) * dPriv->numClipRects);
 
     if (!rects)
         return;
@@ -337,7 +337,7 @@
     }
 
     driReportDamage(dPriv, rects, dPriv->numClipRects);
-    _mesa_free(rects);
+    free(rects);
 }
 
 static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
@@ -430,7 +430,7 @@
      */
     (void) attrs;
 
-    pdp = _mesa_malloc(sizeof *pdp);
+    pdp = malloc(sizeof *pdp);
     if (!pdp) {
 	return NULL;
     }
@@ -457,7 +457,7 @@
 
     if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
 					renderType == GLX_PIXMAP_BIT)) {
-       _mesa_free(pdp);
+       free(pdp);
        return NULL;
     }
 
@@ -510,14 +510,14 @@
 	psp = pdp->driScreenPriv;
         (*psp->DriverAPI.DestroyBuffer)(pdp);
 	if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
-	    _mesa_free(pdp->pClipRects);
+	    free(pdp->pClipRects);
 	    pdp->pClipRects = NULL;
 	}
 	if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
-	    _mesa_free(pdp->pBackClipRects);
+	    free(pdp->pBackClipRects);
 	    pdp->pBackClipRects = NULL;
 	}
-	_mesa_free(pdp);
+	free(pdp);
     }
 }
 
@@ -547,7 +547,7 @@
 {
     if (pcp) {
 	(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
-	_mesa_free(pcp);
+	free(pcp);
     }
 }
 
@@ -577,7 +577,7 @@
     __DRIcontext *pcp;
     void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
 
-    pcp = _mesa_malloc(sizeof *pcp);
+    pcp = malloc(sizeof *pcp);
     if (!pcp)
 	return NULL;
 
@@ -602,7 +602,7 @@
     pcp->hHWContext = hwContext;
 
     if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
-        _mesa_free(pcp);
+        free(pcp);
         return NULL;
     }
 
@@ -656,7 +656,7 @@
 	   (void)drmCloseOnce(psp->fd);
 	}
 
-	_mesa_free(psp);
+	free(psp);
     }
 }
 
@@ -718,7 +718,7 @@
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
 
-    psp = _mesa_calloc(sizeof *psp);
+    psp = calloc(1, sizeof *psp);
     if (!psp)
 	return NULL;
 
@@ -763,7 +763,7 @@
 
     *driver_modes = driDriverAPI.InitScreen(psp);
     if (*driver_modes == NULL) {
-	_mesa_free(psp);
+	free(psp);
 	return NULL;
     }
 
@@ -785,7 +785,7 @@
     if (driDriverAPI.InitScreen2 == NULL)
         return NULL;
 
-    psp = _mesa_calloc(sizeof(*psp));
+    psp = calloc(1, sizeof(*psp));
     if (!psp)
 	return NULL;
 
@@ -807,7 +807,7 @@
     psp->DriverAPI = driDriverAPI;
     *driver_configs = driDriverAPI.InitScreen2(psp);
     if (*driver_configs == NULL) {
-	_mesa_free(psp);
+	free(psp);
 	return NULL;
     }
 
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index fe38f60..48a2c66 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -32,7 +32,7 @@
    /* don't free rb->Data  Chances are it's a memory mapped region for
     * the dri drivers.
     */
-   _mesa_free(rb);
+   free(rb);
 }
 
 
@@ -70,7 +70,7 @@
    assert(cpp > 0);
    assert(pitch > 0);
 
-   drb = _mesa_calloc(sizeof(driRenderbuffer));
+   drb = calloc(1, sizeof(driRenderbuffer));
    if (drb) {
       const GLuint name = 0;
 
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 833f9ad..8c15cbb 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -108,7 +108,7 @@
    cpu = _mesa_get_cpu_string();
    if (cpu) {
       offset += sprintf(buffer + offset, " %s", cpu);
-      _mesa_free(cpu);
+      free(cpu);
    }
 
    return offset;
@@ -559,7 +559,7 @@
    }
 
    num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
-   configs = _mesa_calloc((num_modes + 1) * sizeof *configs);
+   configs = calloc(1, (num_modes + 1) * sizeof *configs);
    if (configs == NULL)
        return NULL;
 
@@ -568,7 +568,7 @@
 	for ( i = 0 ; i < num_db_modes ; i++ ) {
 	    for ( h = 0 ; h < num_msaa_modes; h++ ) {
 	    	for ( j = 0 ; j < num_accum_bits ; j++ ) {
-		    *c = _mesa_malloc (sizeof **c);
+		    *c = malloc (sizeof **c);
 		    modes = &(*c)->modes;
 		    c++;
 
@@ -653,7 +653,7 @@
     while (b[j] != NULL)
 	j++;
    
-    all = _mesa_malloc((i + j + 1) * sizeof *all);
+    all = malloc((i + j + 1) * sizeof *all);
     index = 0;
     for (i = 0; a[i] != NULL; i++)
 	all[index++] = a[i];
@@ -661,8 +661,8 @@
 	all[index++] = b[j];
     all[index++] = NULL;
 
-    _mesa_free(a);
-    _mesa_free(b);
+    free(a);
+    free(b);
 
     return all;
 }
diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c
index 0675bb9..ac07e57 100644
--- a/src/mesa/drivers/dri/fb/fb_dri.c
+++ b/src/mesa/drivers/dri/fb/fb_dri.c
@@ -340,7 +340,7 @@
    assert(driContextPriv);
 
    /* Allocate the Fb context */
-   fbmesa = (fbContextPtr) _mesa_calloc( sizeof(*fbmesa) );
+   fbmesa = (fbContextPtr) calloc(1,  sizeof(*fbmesa) );
    if ( !fbmesa )
       return GL_FALSE;
 
@@ -358,7 +358,7 @@
    ctx = fbmesa->glCtx = _mesa_create_context(glVisual, shareCtx, 
 					      &functions, (void *) fbmesa);
    if (!fbmesa->glCtx) {
-      _mesa_free(fbmesa);
+      free(fbmesa);
       return GL_FALSE;
    }
    driContextPriv->driverPrivate = fbmesa;
@@ -406,7 +406,7 @@
       fbmesa->glCtx->DriverCtx = NULL;
       _mesa_destroy_context( fbmesa->glCtx );
 
-      _mesa_free( fbmesa );
+      free( fbmesa );
    }
 }
 
@@ -449,7 +449,7 @@
       }
       if (mesaVis->doubleBufferMode) {
          /* XXX what are the correct origin/stride values? */
-         GLvoid *backBuf = _mesa_malloc(driScrnPriv->fbStride
+         GLvoid *backBuf = malloc(driScrnPriv->fbStride
                                         * driScrnPriv->fbHeight);
          driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
                                                    backBuf,
@@ -503,7 +503,7 @@
       if (ctx->Visual.doubleBufferMode) {
 	 int i;
 	 int offset = 0;
-         char *tmp = _mesa_malloc(currentPitch);
+         char *tmp = malloc(currentPitch);
 
          _mesa_notifySwapBuffers( ctx );  /* flush pending rendering comands */
 
@@ -516,7 +516,7 @@
             offset += currentPitch;
 	 }
 	    
-	 _mesa_free(tmp);
+	 free(tmp);
       }
    }
    else {
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 6cb8edb..cb9cd83 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -199,7 +199,7 @@
       return;
    }
 
-   buf = (GLfloat *) _mesa_calloc(bufsz);
+   buf = (GLfloat *) calloc(1, bufsz);
 
    /* fragment shader constants */
    if (brw->curbe.wm_size) {
@@ -294,12 +294,12 @@
        bufsz == brw->curbe.last_bufsz &&
        memcmp(buf, brw->curbe.last_buf, bufsz) == 0) {
       /* constants have not changed */
-      _mesa_free(buf);
+      free(buf);
    } 
    else {
       /* constants have changed */
       if (brw->curbe.last_buf)
-	 _mesa_free(brw->curbe.last_buf);
+	 free(brw->curbe.last_buf);
 
       brw->curbe.last_buf = buf;
       brw->curbe.last_bufsz = bufsz;
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index c46b9ba..ceaeb92 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -320,7 +320,7 @@
       } else {
 	 void *data;
 
-	 data = _mesa_malloc(dst_stride * element->count);
+	 data = malloc(dst_stride * element->count);
 	 dest = data;
 	 for (i = 0; i < element->count; i++) {
 	    memcpy(dest, src, dst_stride);
@@ -333,7 +333,7 @@
 			size,
 			data);
 
-	 _mesa_free(data);
+	 free(data);
       }
    }
 }
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index 1df5613..4e7c122 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -237,7 +237,7 @@
         struct brw_glsl_call *call, *next;
         for (call = c->first_call; call; call = next) {
 	    next = call->next;
-	    _mesa_free(call);
+	    free(call);
 	}
 	c->first_call = NULL;
     }
@@ -247,7 +247,7 @@
         struct brw_glsl_label *label, *next;
 	for (label = c->first_label; label; label = next) {
 	    next = label->next;
-	    _mesa_free(label);
+	    free(label);
 	}
 	c->first_label = NULL;
     }
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 5399a74..6cce7e5 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -73,7 +73,7 @@
 {
    struct brw_query_object *query;
 
-   query = _mesa_calloc(sizeof(struct brw_query_object));
+   query = calloc(1, sizeof(struct brw_query_object));
 
    query->Base.Id = id;
    query->Base.Result = 0;
@@ -89,7 +89,7 @@
    struct brw_query_object *query = (struct brw_query_object *)q;
 
    dri_bo_unreference(query->bo);
-   _mesa_free(query);
+   free(query);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/brw_state_batch.c b/src/mesa/drivers/dri/i965/brw_state_batch.c
index ed8120d..3901941 100644
--- a/src/mesa/drivers/dri/i965/brw_state_batch.c
+++ b/src/mesa/drivers/dri/i965/brw_state_batch.c
@@ -57,8 +57,8 @@
 	 if (item->sz == sz && memcmp(item->header, newheader, sz) == 0)
 	    return GL_FALSE;
 	 if (item->sz != sz) {
-	    _mesa_free(item->header);
-	    item->header = _mesa_malloc(sz);
+	    free(item->header);
+	    item->header = malloc(sz);
 	    item->sz = sz;
 	 }
 	 goto emit;
@@ -68,7 +68,7 @@
 
    assert(!item);
    item = CALLOC_STRUCT(brw_cached_batch_item);
-   item->header = _mesa_malloc(sz);
+   item->header = malloc(sz);
    item->sz = sz;
    item->next = brw->cached_batch_items;
    brw->cached_batch_items = item;
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index 1369d97..dd9894d 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -150,7 +150,7 @@
    GLuint size, i;
 
    size = cache->size * 3;
-   items = (struct brw_cache_item**) _mesa_calloc(size * sizeof(*items));
+   items = (struct brw_cache_item**) calloc(1, size * sizeof(*items));
 
    for (i = 0; i < cache->size; i++)
       for (c = cache->items[i]; c; c = next) {
@@ -237,7 +237,7 @@
 
 
    /* Set up the memory containing the key, aux_data, and reloc_bufs */
-   tmp = _mesa_malloc(key_size + aux_size + relocs_size);
+   tmp = malloc(key_size + aux_size + relocs_size);
 
    memcpy(tmp, key, key_size);
    memcpy(tmp + key_size, aux, aux_size);
@@ -366,7 +366,7 @@
    cache->size = 7;
    cache->n_items = 0;
    cache->items = (struct brw_cache_item **)
-      _mesa_calloc(cache->size * sizeof(struct brw_cache_item));
+      calloc(1, cache->size * sizeof(struct brw_cache_item));
 
    brw_init_cache_id(cache, "CC_VP", BRW_CC_VP);
    brw_init_cache_id(cache, "CC_UNIT", BRW_CC_UNIT);
@@ -403,7 +403,7 @@
    cache->size = 7;
    cache->n_items = 0;
    cache->items = (struct brw_cache_item **)
-      _mesa_calloc(cache->size * sizeof(struct brw_cache_item));
+      calloc(1, cache->size * sizeof(struct brw_cache_item));
 
    brw_init_cache_id(cache, "SS_SURFACE", BRW_SS_SURFACE);
    brw_init_cache_id(cache, "SS_SURF_BIND", BRW_SS_SURF_BIND);
@@ -444,7 +444,7 @@
    cache->n_items = 0;
 
    if (brw->curbe.last_buf) {
-      _mesa_free(brw->curbe.last_buf);
+      free(brw->curbe.last_buf);
       brw->curbe.last_buf = NULL;
    }
 
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 681319d..0b0be02 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -67,11 +67,11 @@
    brw_draw_destroy( brw );
    brw_clear_validated_bos(brw);
    if (brw->wm.compile_data) {
-      _mesa_free(brw->wm.compile_data->instruction);
-      _mesa_free(brw->wm.compile_data->vreg);
-      _mesa_free(brw->wm.compile_data->refs);
-      _mesa_free(brw->wm.compile_data->prog_instructions);
-      _mesa_free(brw->wm.compile_data);
+      free(brw->wm.compile_data->instruction);
+      free(brw->wm.compile_data->vreg);
+      free(brw->wm.compile_data->refs);
+      free(brw->wm.compile_data->prog_instructions);
+      free(brw->wm.compile_data);
    }
 
    for (i = 0; i < brw->state.nr_color_regions; i++)
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 9191c81..991e1b9 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -151,11 +151,11 @@
           */
          return;
       }
-      c->instruction = _mesa_calloc(BRW_WM_MAX_INSN * sizeof(*c->instruction));
-      c->prog_instructions = _mesa_calloc(BRW_WM_MAX_INSN *
+      c->instruction = calloc(1, BRW_WM_MAX_INSN * sizeof(*c->instruction));
+      c->prog_instructions = calloc(1, BRW_WM_MAX_INSN *
 					  sizeof(*c->prog_instructions));
-      c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
-      c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs));
+      c->vreg = calloc(1, BRW_WM_MAX_VREG * sizeof(*c->vreg));
+      c->refs = calloc(1, BRW_WM_MAX_REF * sizeof(*c->refs));
    } else {
       void *instruction = c->instruction;
       void *prog_instructions = c->prog_instructions;
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 3b7015b..312866d 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -113,7 +113,7 @@
    if (obj->Pointer)
       intel_bufferobj_unmap(ctx, 0, obj);
 
-   _mesa_free(intel_obj->sys_buffer);
+   free(intel_obj->sys_buffer);
    if (intel_obj->region) {
       intel_bufferobj_release_region(intel, intel_obj);
    }
@@ -121,7 +121,7 @@
       dri_bo_unreference(intel_obj->buffer);
    }
 
-   _mesa_free(intel_obj);
+   free(intel_obj);
 }
 
 
@@ -155,7 +155,7 @@
       dri_bo_unreference(intel_obj->buffer);
       intel_obj->buffer = NULL;
    }
-   _mesa_free(intel_obj->sys_buffer);
+   free(intel_obj->sys_buffer);
    intel_obj->sys_buffer = NULL;
 
    if (size != 0) {
@@ -164,7 +164,7 @@
        * with their contents anyway.
        */
       if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) {
-	 intel_obj->sys_buffer = _mesa_malloc(size);
+	 intel_obj->sys_buffer = malloc(size);
 	 if (intel_obj->sys_buffer != NULL) {
 	    if (data != NULL)
 	       memcpy(intel_obj->sys_buffer, data, size);
@@ -373,7 +373,7 @@
    if ((access & GL_MAP_INVALIDATE_RANGE_BIT) &&
        drm_intel_bo_busy(intel_obj->buffer)) {
       if (access & GL_MAP_FLUSH_EXPLICIT_BIT) {
-	 intel_obj->range_map_buffer = _mesa_malloc(length);
+	 intel_obj->range_map_buffer = malloc(length);
 	 obj->Pointer = intel_obj->range_map_buffer;
       } else {
 	 intel_obj->range_map_bo = drm_intel_bo_alloc(intel->bufmgr,
@@ -523,7 +523,7 @@
 			      intel_obj->Base.Size,
 			      sys_buffer,
 			      &intel_obj->Base);
-      _mesa_free(sys_buffer);
+      free(sys_buffer);
       intel_obj->sys_buffer = NULL;
    }
 
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index d58ffd9..40b8679 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -71,13 +71,13 @@
    ASSERT(irb);
 
    if (irb->span_cache != NULL)
-      _mesa_free(irb->span_cache);
+      free(irb->span_cache);
 
    if (intel && irb->region) {
       intel_region_release(&irb->region);
    }
 
-   _mesa_free(irb);
+   free(irb);
 }
 
 
@@ -316,7 +316,7 @@
    default:
       _mesa_problem(NULL,
                     "Unexpected intFormat in intel_create_renderbuffer");
-      _mesa_free(irb);
+      free(irb);
       return NULL;
    }
 
@@ -468,7 +468,7 @@
    irb->Base.ClassID = INTEL_RB_CLASS;
 
    if (!intel_update_wrapper(ctx, irb, texImage)) {
-      _mesa_free(irb);
+      free(irb);
       return NULL;
    }
 
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index eabfbf4..54998a6 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -395,7 +395,7 @@
    }
 
    /* Convert the A1 bitmap to an A8 format suitable for glTexImage */
-   a8_bitmap = _mesa_calloc(width * height);
+   a8_bitmap = calloc(1, width * height);
    _mesa_expand_bitmap(width, height, unpack, bitmap, a8_bitmap, width, 0xff);
 
    if (_mesa_is_bufferobj(unpack->BufferObj)) {
@@ -430,7 +430,7 @@
    _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1);
    _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0,
 		    GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap);
-   _mesa_free(a8_bitmap);
+   free(a8_bitmap);
 
    meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp);
    _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 1017722..bd1dd13 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -147,7 +147,7 @@
 
    /* Unpack the supplied stencil values into a ubyte buffer. */
    assert(sizeof(GLstencil) == sizeof(GLubyte));
-   stencil_pixels = _mesa_malloc(width * height * sizeof(GLstencil));
+   stencil_pixels = malloc(width * height * sizeof(GLstencil));
    for (row = 0; row < height; row++) {
       GLvoid *source = _mesa_image_address2d(unpack, pixels,
 					     width, height,
@@ -201,7 +201,7 @@
    _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0,
 		    GL_RED, GL_UNSIGNED_BYTE, stencil_pixels);
    ctx->Unpack = old_unpack;
-   _mesa_free(stencil_pixels);
+   free(stencil_pixels);
 
    meta_set_passthrough_transform(&intel->meta);
 
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 97bb972..0072bb1 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -49,7 +49,7 @@
 get_span_cache(struct intel_renderbuffer *irb, uint32_t offset)
 {
    if (irb->span_cache == NULL) {
-      irb->span_cache = _mesa_malloc(SPAN_CACHE_SIZE);
+      irb->span_cache = malloc(SPAN_CACHE_SIZE);
       irb->span_cache_offset = -1;
    }
 
diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c
index 0d7889d..d67f0cb 100644
--- a/src/mesa/drivers/dri/intel/intel_syncobj.c
+++ b/src/mesa/drivers/dri/intel/intel_syncobj.c
@@ -50,7 +50,7 @@
 {
    struct intel_sync_object *sync;
 
-   sync = _mesa_calloc(sizeof(struct intel_sync_object));
+   sync = calloc(1, sizeof(struct intel_sync_object));
 
    return &sync->Base;
 }
@@ -61,7 +61,7 @@
    struct intel_sync_object *sync = (struct intel_sync_object *)s;
 
    drm_intel_bo_unreference(sync->bo);
-   _mesa_free(sync);
+   free(sync);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index acc66e0..a5810ee 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -277,7 +277,7 @@
 		fp = fp->next;
 	}
 
-	fp = _mesa_calloc(sizeof(struct r300_fragment_program));
+	fp = calloc(1, sizeof(struct r300_fragment_program));
 
 	fp->state = state;
 
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index 3638010..9c24166 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -39,7 +39,7 @@
 	while (fp) {
 		tmp = fp->next;
 		rc_constants_destroy(&fp->code.constants);
-		_mesa_free(fp);
+		free(fp);
 		fp = tmp;
 	}
 }
@@ -52,7 +52,7 @@
 		tmp = vp->next;
 		rc_constants_destroy(&vp->code.constants);
 		_mesa_reference_vertprog(ctx, &vp->Base, NULL);
-		_mesa_free(vp);
+		free(vp);
 		vp = tmp;
 	}
 }
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index a74b700..6a366b4 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -233,7 +233,7 @@
 	struct r300_vertex_program *vp;
 	struct r300_vertex_program_compiler compiler;
 
-	vp = _mesa_calloc(sizeof(*vp));
+	vp = calloc(1, sizeof(*vp));
 	vp->Base = _mesa_clone_vertex_program(ctx, mesa_vp);
 	memcpy(&vp->key, wanted_key, sizeof(vp->key));
 
diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c
index 2a50361..b7124e6 100644
--- a/src/mesa/drivers/dri/r600/r700_oglprog.c
+++ b/src/mesa/drivers/dri/r600/r700_oglprog.c
@@ -53,7 +53,7 @@
 		Clean_Up_Shader(&(vp->r700Shader));
 		
 		_mesa_reference_vertprog(ctx, &vp->mesa_program, NULL);
-		_mesa_free(vp);
+		free(vp);
 		vp = tmp;
 	}
 }
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index 46481cd..07e0adc 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -307,7 +307,7 @@
 	struct r700_vertex_program *vp;
 	unsigned int i;
 
-	vp = _mesa_calloc(sizeof(*vp));
+	vp = calloc(1, sizeof(*vp));
 	vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp);
 
 	if (mesa_vp->IsPositionInvariant)
diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
index bc5915d..0897daf 100644
--- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
+++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
@@ -70,7 +70,7 @@
         radeon_bo_unref(radeon_obj->bo);
     }
 
-    _mesa_free(radeon_obj);
+    free(radeon_obj);
 }
 
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 56dcc507..a8931e8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -66,7 +66,7 @@
   if (rrb && rrb->bo) {
     radeon_bo_unref(rrb->bo);
   }
-  _mesa_free(rrb);
+  free(rrb);
 }
 
 static void *
@@ -511,7 +511,7 @@
    rrb->base.ClassID = RADEON_RB_CLASS;
 
    if (!radeon_update_wrapper(ctx, rrb, texImage)) {
-      _mesa_free(rrb);
+      free(rrb);
       return NULL;
    }
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index d0dcf0e..04ce124 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -81,7 +81,7 @@
 {
 	struct radeon_query_object *query;
 
-	query = _mesa_calloc(sizeof(struct radeon_query_object));
+	query = calloc(1, sizeof(struct radeon_query_object));
 
 	query->Base.Id = id;
 	query->Base.Result = 0;
@@ -103,7 +103,7 @@
 		radeon_bo_unref(query->bo);
 	}
 
-	_mesa_free(query);
+	free(query);
 }
 
 static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 9b9d90b..ff37fd3 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -637,7 +637,7 @@
 	int i;
 	GLuint *offsets;
 
-	offsets = _mesa_malloc(depth * sizeof(GLuint)) ;
+	offsets = malloc(depth * sizeof(GLuint)) ;
 	if (!offsets) {
 		_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex[Sub]Image");
 		return NULL;
@@ -736,7 +736,7 @@
 	}
 
 	if (dims == 3) {
-		_mesa_free(dstImageOffsets);
+		free(dstImageOffsets);
 	}
 
 	radeon_teximage_unmap(image);
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 74a001b..6f07ac2 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -179,7 +179,7 @@
    }
 
    /* Allocate the private area */
-   savageScreen = (savageScreenPrivate *)_mesa_malloc(sizeof(savageScreenPrivate));
+   savageScreen = (savageScreenPrivate *)malloc(sizeof(savageScreenPrivate));
    if (!savageScreen)
       return GL_FALSE;
 
@@ -226,7 +226,7 @@
 		  savageScreen->agpTextures.handle,
 		  savageScreen->agpTextures.size,
 		  (drmAddress *)&(savageScreen->agpTextures.map)) != 0) {
-	   _mesa_free(savageScreen);
+	   free(savageScreen);
 	   sPriv->private = NULL;
 	   return GL_FALSE;
        }
@@ -246,7 +246,7 @@
 	      savageScreen->aperture.size, 
 	      (drmAddress *)&savageScreen->aperture.map) != 0) 
    {
-      _mesa_free(savageScreen);
+      free(savageScreen);
       sPriv->private = NULL;
       return GL_FALSE;
    }
@@ -282,7 +282,7 @@
    /* free all option information */
    driDestroyOptionInfo (&savageScreen->optionCache);
 
-   _mesa_free(savageScreen);
+   free(savageScreen);
    sPriv->private = NULL;
 }
 
@@ -300,7 +300,7 @@
 						 savageScreen->sarea_priv_offset);
    int textureSize[SAVAGE_NR_TEX_HEAPS];
    int i;
-   imesa = (savageContextPtr)_mesa_calloc(sizeof(savageContext));
+   imesa = (savageContextPtr)calloc(1, sizeof(savageContext));
    if (!imesa) {
       return GL_FALSE;
    }
@@ -317,7 +317,7 @@
       shareCtx = NULL;
    ctx = _mesa_create_context(mesaVis, shareCtx, &functions, imesa);
    if (!ctx) {
-      _mesa_free(imesa);
+      free(imesa);
       return GL_FALSE;
    }
    driContextPriv->driverPrivate = imesa;
@@ -436,7 +436,7 @@
    if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
        __driUtilMessage("Not enough texture memory. "
 			"Falling back to indirect rendering.");
-       _mesa_free(imesa);
+       free(imesa);
        return GL_FALSE;
    }
 
@@ -574,7 +574,7 @@
       _mesa_destroy_context(imesa->glCtx);
 
       /* no longer use vertex_dma_buf*/
-      _mesa_free(imesa);
+      free(imesa);
    }
 }
 
diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c
index 394be44..1a748ee 100644
--- a/src/mesa/drivers/dri/savage/savagetex.c
+++ b/src/mesa/drivers/dri/savage/savagetex.c
@@ -603,7 +603,7 @@
             dstRow += dstRowStride;
 	}
     }
-    _mesa_free((void *) tempImage);
+    free((void *) tempImage);
 
     return GL_TRUE;
 }
@@ -643,7 +643,7 @@
             dstRow += dstRowStride;
 	}
     }
-    _mesa_free((void *) tempImage);
+    free((void *) tempImage);
 
     return GL_TRUE;
 }
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 40535b0..b2e7df3 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -155,7 +155,7 @@
 
     TRACE;
 
-    psp = _mesa_calloc(sizeof(*psp));
+    psp = calloc(1, sizeof(*psp));
     if (!psp)
 	return NULL;
 
@@ -184,7 +184,7 @@
     TRACE;
 
     if (psp) {
-	_mesa_free(psp);
+	free(psp);
     }
 }
 
@@ -241,8 +241,8 @@
 {
     TRACE;
 
-    _mesa_free(rb->Data);
-    _mesa_free(rb);
+    free(rb->Data);
+    free(rb);
 }
 
 static GLboolean
@@ -272,11 +272,11 @@
 
     TRACE;
 
-    _mesa_free(rb->Data);
+    free(rb->Data);
 
     swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
 
-    rb->Data = _mesa_malloc(height * xrb->pitch);
+    rb->Data = malloc(height * xrb->pitch);
 
     return GL_TRUE;
 }
@@ -284,7 +284,7 @@
 static struct swrast_renderbuffer *
 swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
 {
-    struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb);
+    struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
     GLuint pixel_format;
 
     TRACE;
@@ -358,7 +358,7 @@
 
     TRACE;
 
-    buf = _mesa_calloc(sizeof *buf);
+    buf = calloc(1, sizeof *buf);
     if (!buf)
 	return NULL;
 
@@ -366,7 +366,7 @@
 
     buf->driScreenPriv = screen;
 
-    buf->row = _mesa_malloc(MAX_WIDTH * 4);
+    buf->row = malloc(MAX_WIDTH * 4);
 
     /* basic framebuffer setup */
     _mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
@@ -401,7 +401,7 @@
     if (buf) {
 	struct gl_framebuffer *fb = &buf->Base;
 
-	_mesa_free(buf->row);
+	free(buf->row);
 
 	fb->DeletePending = GL_TRUE;
 	_mesa_reference_framebuffer(&fb, NULL);
@@ -525,7 +525,7 @@
 
     TRACE;
 
-    ctx = _mesa_calloc(sizeof *ctx);
+    ctx = calloc(1, sizeof *ctx);
     if (!ctx)
 	return NULL;
 
@@ -540,7 +540,7 @@
     if (!_mesa_initialize_context(&ctx->Base, &config->modes,
 				  shared ? &shared->Base : NULL,
 				  &functions, (void *) ctx)) {
-      _mesa_free(ctx);
+      free(ctx);
       return NULL;
     }
 
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c
index e4fb29f..bebf061 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.c
+++ b/src/mesa/drivers/dri/unichrome/via_fb.c
@@ -156,7 +156,7 @@
    }
    else if (t->memType == VIA_MEM_SYSTEM) {
       
-      t->bufAddr = _mesa_malloc(t->size);      
+      t->bufAddr = malloc(t->size);      
       if (!t->bufAddr)
 	 goto cleanup;
 
@@ -226,8 +226,8 @@
    else if (t->memType == VIA_MEM_SYSTEM) {
       remove_from_list(t);
       vmesa->total_alloc[t->memType] -= t->size;
-      _mesa_free(t->bufAddr);
-      _mesa_free(t);
+      free(t->bufAddr);
+      free(t);
    }
    else if (t->index && viaCheckBreadcrumb(vmesa, t->lastUsed)) {
       via_do_free_texture( vmesa, t );
diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c
index 4900251..4e369ce 100644
--- a/src/mesa/drivers/fbdev/glfbdev.c
+++ b/src/mesa/drivers/fbdev/glfbdev.c
@@ -392,7 +392,7 @@
          break;
       default:
          /* unexpected token */
-         _mesa_free(vis);
+         free(vis);
          return NULL;
       }
    }
@@ -431,7 +431,7 @@
          }
          else {
             _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
-            _mesa_free(vis);
+            free(vis);
             return NULL;
          }
       }
@@ -445,7 +445,7 @@
       }
       else {
          _mesa_problem(NULL, "Unsupported fbdev CI visual/bitdepth!\n");
-         _mesa_free(vis);
+         free(vis);
          return NULL;
       }
    }
@@ -457,7 +457,7 @@
                                 accumBlueBits, accumAlphaBits,
                                 numSamples)) {
       /* something was invalid */
-      _mesa_free(vis);
+      free(vis);
       return NULL;
    }
 
@@ -469,7 +469,7 @@
 glFBDevDestroyVisual( GLFBDevVisualPtr visual )
 {
    if (visual)
-      _mesa_free(visual);
+      free(visual);
 }
 
 
@@ -488,9 +488,9 @@
 {
    struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
    if (frb->mallocedBuffer) {
-      _mesa_free(frb->Base.Data);
+      free(frb->Base.Data);
    }
-   _mesa_free(frb);
+   free(frb);
 }
 
 
@@ -636,10 +636,10 @@
       const int malloced = !backBuffer;
       if (malloced) {
          /* malloc a back buffer */
-         backBuffer = _mesa_malloc(size);
+         backBuffer = malloc(size);
          if (!backBuffer) {
             _mesa_free_framebuffer_data(&buf->glframebuffer);
-            _mesa_free(buf);
+            free(buf);
             return NULL;
          }
       }
@@ -769,7 +769,7 @@
    if (!_mesa_initialize_context(&ctx->glcontext, &visual->glvisual,
                                  share ? &share->glcontext : NULL,
                                  &functions, (void *) ctx)) {
-      _mesa_free(ctx);
+      free(ctx);
       return NULL;
    }
 
@@ -818,7 +818,7 @@
          _mesa_make_current(NULL, NULL, NULL);
       }
       _mesa_free_context_data(&context->glcontext);
-      _mesa_free(context);
+      free(context);
    }
 }
 
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index d94bf08..b78b101 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1628,7 +1628,7 @@
              if (ctx->Extensions.String == NULL) {
                 GLubyte *ext = _mesa_make_extension_string(ctx);
                 if (ext != NULL) {
-                   ctx->Extensions.String = _mesa_malloc(strlen((char *)ext) + 256);
+                   ctx->Extensions.String = malloc(strlen((char *)ext) + 256);
                    if (ctx->Extensions.String != NULL) {
                       strcpy((char *)ctx->Extensions.String, (char *)ext);
                       /* put any additional extension names here */
@@ -1641,7 +1641,7 @@
                       strcat((char *)ctx->Extensions.String, " WGL_EXT_extensions_string WGL_ARB_extensions_string");
 #endif
                       /* put any additional extension names here */
-                      _mesa_free(ext);
+                      free(ext);
                    } else {
                       ctx->Extensions.String = ext;
                    }
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index a87a28a..b35874f 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -1397,10 +1397,10 @@
                                                          mml->width,
                                                          mml->height, 1);
       dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width);
-      texImage->Data = _mesa_malloc(texImage->CompressedSize);
+      texImage->Data = malloc(texImage->CompressedSize);
    } else {
       dstRowStride = mml->width * texelBytes;
-      texImage->Data = _mesa_malloc(mml->width * mml->height * texelBytes);
+      texImage->Data = malloc(mml->width * mml->height * texelBytes);
    }
    if (!texImage->Data) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
@@ -1654,7 +1654,7 @@
       texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat,
                                                          mml->width,
                                                          mml->height, 1);
-      texImage->Data = _mesa_malloc(texImage->CompressedSize);
+      texImage->Data = malloc(texImage->CompressedSize);
       if (!texImage->Data) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
          return;
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 9bf3796..9bb352f 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -107,14 +107,14 @@
                       &(mml->wScale), &(mml->hScale));
          _w *= mml->wScale;
          _h *= mml->hScale;
-         texImage->Data = _mesa_malloc(_w * _h * texelBytes);
+         texImage->Data = malloc(_w * _h * texelBytes);
          _mesa_rescale_teximage2d(texelBytes,
                                   mml->width,
                                   _w * texelBytes, /* dst stride */
                                   mml->width, mml->height, /* src */
                                   _w, _h, /* dst */
                                   texImage_Data /*src*/, texImage->Data /*dst*/ );
-         _mesa_free(texImage_Data);
+         free(texImage_Data);
          mml->width = _w;
          mml->height = _h;
          /* (!) ... and set mml->wScale = _w / texImage->Width */
diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c
index e4527ab..448029d 100644
--- a/src/mesa/drivers/glslcompiler/glslcompiler.c
+++ b/src/mesa/drivers/glslcompiler/glslcompiler.c
@@ -119,7 +119,7 @@
                              0, 0, 0, 0, 1);  /* accum */
    buf = _mesa_create_framebuffer(vis);
 
-   cc = _mesa_calloc(sizeof(*cc));
+   cc = calloc(1, sizeof(*cc));
    if (!vis || !buf || !cc) {
       if (vis)
          _mesa_destroy_visual(vis);
@@ -143,7 +143,7 @@
        !_swsetup_CreateContext( ctx )) {
       _mesa_destroy_visual(vis);
       _mesa_free_context_data(ctx);
-      _mesa_free(cc);
+      free(cc);
       return GL_FALSE;
    }
    TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 1c469b1..f9672d8 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -818,7 +818,7 @@
 static void
 osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
 {
-   _mesa_free(rb);
+   free(rb);
 }
 
 
@@ -1189,7 +1189,7 @@
                                                1            /* num samples */
                                                );
       if (!osmesa->gl_visual) {
-         _mesa_free(osmesa);
+         free(osmesa);
          return NULL;
       }
 
@@ -1206,7 +1206,7 @@
                                               : (GLcontext *) NULL,
                                     &functions, (void *) osmesa)) {
          _mesa_destroy_visual( osmesa->gl_visual );
-         _mesa_free(osmesa);
+         free(osmesa);
          return NULL;
       }
 
@@ -1221,7 +1221,7 @@
       if (!osmesa->gl_buffer) {
          _mesa_destroy_visual( osmesa->gl_visual );
          _mesa_free_context_data( &osmesa->mesa );
-         _mesa_free(osmesa);
+         free(osmesa);
          return NULL;
       }
 
@@ -1260,7 +1260,7 @@
              !_swsetup_CreateContext( ctx )) {
             _mesa_destroy_visual(osmesa->gl_visual);
             _mesa_free_context_data(ctx);
-            _mesa_free(osmesa);
+            free(osmesa);
             return NULL;
          }
 	
@@ -1305,7 +1305,7 @@
       _mesa_reference_framebuffer( &osmesa->gl_buffer, NULL );
 
       _mesa_free_context_data( &osmesa->mesa );
-      _mesa_free( osmesa );
+      free( osmesa );
    }
 }
 
diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def
index d7d6cfa..baa592f 100644
--- a/src/mesa/drivers/windows/gdi/mesa.def
+++ b/src/mesa/drivers/windows/gdi/mesa.def
@@ -868,7 +868,6 @@
 	_mesa_add_soft_renderbuffers
 	_mesa_add_renderbuffer
 	_mesa_bzero
-	_mesa_calloc
 	_mesa_check_conditional_render
 	_mesa_choose_tex_format
 	_mesa_create_framebuffer
@@ -887,7 +886,6 @@
 	_mesa_error
 	_mesa_finish_render_texture
 	_mesa_framebuffer_renderbuffer
-	_mesa_free
 	_mesa_free_context_data
 	_mesa_free_texture_image_data
 	_mesa_generate_mipmap
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index b24b758..2fdcb38 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -1245,7 +1245,7 @@
 static void
 wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
 {
-    _mesa_free(rb);
+    free(rb);
 }
 
 
@@ -1474,7 +1474,7 @@
                                  1);         /* num samples */
     
     if (!visual) {
-	_mesa_free(c);
+	free(c);
 	return NULL;
     }
 
@@ -1512,7 +1512,7 @@
         !_tnl_CreateContext(ctx) ||
 	!_swsetup_CreateContext(ctx)) {
 	_mesa_free_context_data(ctx);
-	_mesa_free(c);
+	free(c);
 	return NULL;
     }
     _swsetup_Wakeup(ctx);
@@ -1557,7 +1557,7 @@
     _swrast_DestroyContext(ctx);
     
     _mesa_free_context_data(ctx);
-    _mesa_free(pwc);
+    free(pwc);
 }
 
 
diff --git a/src/mesa/drivers/windows/icd/mesa.def b/src/mesa/drivers/windows/icd/mesa.def
index f6bd2aa..6f33d17 100644
--- a/src/mesa/drivers/windows/icd/mesa.def
+++ b/src/mesa/drivers/windows/icd/mesa.def
@@ -32,8 +32,6 @@
 	_mesa_buffer_data
 	_mesa_buffer_map
 	_mesa_buffer_subdata
-	_mesa_bzero
-	_mesa_calloc
 	_mesa_choose_tex_format
 	_mesa_compressed_texture_size
 	_mesa_create_framebuffer
@@ -47,7 +45,6 @@
 	_mesa_enable_1_5_extensions
 	_mesa_enable_sw_extensions
 	_mesa_error
-	_mesa_free
 	_mesa_free_context_data
 	_mesa_get_current_context
 	_mesa_init_default_imports
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 291e90c..f097d93 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1381,7 +1381,7 @@
       return xmvis->vishandle;
 #else
       /* create a new vishandle - the cached one may be stale */
-      xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
+      xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
       if (xmvis->vishandle) {
          memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
       }
@@ -1438,7 +1438,7 @@
       xmvis = create_glx_visual( dpy, visinfo );
       if (!xmvis) {
          /* unusable visual */
-         _mesa_free(glxCtx);
+         free(glxCtx);
          return NULL;
       }
    }
@@ -1446,7 +1446,7 @@
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
    if (!glxCtx->xmesaContext) {
-      _mesa_free(glxCtx);
+      free(glxCtx);
       return NULL;
    }
 
@@ -1671,7 +1671,7 @@
    MakeCurrent_PrevReadBuffer = 0;
    XMesaDestroyContext( glxCtx->xmesaContext );
    XMesaGarbageCollect();
-   _mesa_free(glxCtx);
+   free(glxCtx);
 }
 
 
@@ -2108,7 +2108,7 @@
    visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
    if (*nelements > 0) {
       XMesaVisual *results;
-      results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
+      results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual));
       if (!results) {
          *nelements = 0;
          return NULL;
@@ -2135,7 +2135,7 @@
 
    xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
    if (xmvis) {
-      GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
+      GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual));
       if (!config) {
          *nitems = 0;
          return NULL;
@@ -2160,7 +2160,7 @@
       return xmvis->vishandle;
 #else
       /* create a new vishandle - the cached one may be stale */
-      xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
+      xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
       if (xmvis->vishandle) {
          memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
       }
@@ -2469,7 +2469,7 @@
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
    if (!glxCtx->xmesaContext) {
-      _mesa_free(glxCtx);
+      free(glxCtx);
       return NULL;
    }
 
@@ -2687,7 +2687,7 @@
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
    if (!glxCtx->xmesaContext) {
-      _mesa_free(glxCtx);
+      free(glxCtx);
       return NULL;
    }
 
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 98ce6c5..ed94502 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -253,7 +253,7 @@
    /* grab the bits/pixel value */
    bitsPerPixel = img->bits_per_pixel;
    /* free the XImage */
-   _mesa_free( img->data );
+   free( img->data );
    img->data = NULL;
    XMesaDestroyImage( img );
    return bitsPerPixel;
@@ -383,7 +383,7 @@
     */
    b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE);
    if (!b->frontxrb) {
-      _mesa_free(b);
+      free(b);
       return NULL;
    }
    b->frontxrb->Parent = b;
@@ -399,7 +399,7 @@
       b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE);
       if (!b->backxrb) {
          /* XXX free front xrb too */
-         _mesa_free(b);
+         free(b);
          return NULL;
       }
       b->backxrb->Parent = b;
@@ -596,7 +596,7 @@
        || prevCmapSize != cmapSize || !ctable) {
       /* free previously cached color table */
       if (ctable)
-         _mesa_free(ctable);
+         free(ctable);
       /* Get the color table from X */
       ctable = (XMesaColor *) MALLOC(cmapSize * sizeof(XMesaColor));
       assert(ctable);
@@ -652,8 +652,8 @@
       *alloced = 0;
    }
 #ifdef XFree86Server
-   _mesa_free(ppixIn);
-   _mesa_free(ctable);
+   free(ppixIn);
+   free(ctable);
 #else
    /* don't free table, save it for next time */
 #endif
@@ -1366,14 +1366,14 @@
 
    v->display = display;
 
-   /* Save a copy of the XVisualInfo struct because the user may X_mesa_free()
+   /* Save a copy of the XVisualInfo struct because the user may Xfree()
     * the struct but we may need some of the information contained in it
     * at a later time.
     */
 #ifndef XFree86Server
    v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
    if(!v->visinfo) {
-      _mesa_free(v);
+      free(v);
       return NULL;
    }
    memcpy(v->visinfo, visinfo, sizeof(*visinfo));
@@ -1473,9 +1473,9 @@
 void XMesaDestroyVisual( XMesaVisual v )
 {
 #ifndef XFree86Server
-   _mesa_free(v->visinfo);
+   free(v->visinfo);
 #endif
-   _mesa_free(v);
+   free(v);
 }
 
 
@@ -1514,7 +1514,7 @@
    if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual,
                       share_list ? &(share_list->mesa) : (GLcontext *) NULL,
                       &functions, (void *) c)) {
-      _mesa_free(c);
+      free(c);
       return NULL;
    }
 
@@ -1564,7 +1564,7 @@
        !_tnl_CreateContext( mesaCtx ) ||
        !_swsetup_CreateContext( mesaCtx )) {
       _mesa_free_context_data(&c->mesa);
-      _mesa_free(c);
+      free(c);
       return NULL;
    }
 
@@ -1598,7 +1598,7 @@
    _tnl_DestroyContext( mesaCtx );
    _vbo_DestroyContext( mesaCtx );
    _mesa_free_context_data( mesaCtx );
-   _mesa_free( c );
+   free( c );
 }
 
 
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index bf38629..5ffe110 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -242,7 +242,7 @@
     * should probably get freed here, but that's currently done in
     * XMesaDestroyBuffer().
     */
-   _mesa_free(rb);
+   free(rb);
 }
 
 
@@ -412,11 +412,11 @@
    }
 
    if (b->rowimage) {
-      _mesa_free( b->rowimage->data );
+      free( b->rowimage->data );
       b->rowimage->data = NULL;
       XMesaDestroyImage( b->rowimage );
    }
 
    _mesa_free_framebuffer_data(fb);
-   _mesa_free(fb);
+   free(fb);
 }
diff --git a/src/mesa/es/main/specials_es1.c b/src/mesa/es/main/specials_es1.c
index a4f1449..c842007 100644
--- a/src/mesa/es/main/specials_es1.c
+++ b/src/mesa/es/main/specials_es1.c
@@ -167,7 +167,7 @@
       unsigned int len;
 
       len = make_extension_string(ctx, NULL);
-      s = (char *) _mesa_malloc(len + 1);
+      s = (char *) malloc(len + 1);
       if (!s)
          return NULL;
       make_extension_string(ctx, s);
diff --git a/src/mesa/es/main/specials_es2.c b/src/mesa/es/main/specials_es2.c
index e11ade9..10b4f25 100644
--- a/src/mesa/es/main/specials_es2.c
+++ b/src/mesa/es/main/specials_es2.c
@@ -138,7 +138,7 @@
       unsigned int len;
 
       len = make_extension_string(ctx, NULL);
-      s = (char *) _mesa_malloc(len + 1);
+      s = (char *) malloc(len + 1);
       if (!s)
          return NULL;
       make_extension_string(ctx, s);
diff --git a/src/mesa/glapi/mesadef.py b/src/mesa/glapi/mesadef.py
index 59cea59..38b0246 100644
--- a/src/mesa/glapi/mesadef.py
+++ b/src/mesa/glapi/mesadef.py
@@ -113,8 +113,6 @@
 	print '\t_mesa_buffer_data'
 	print '\t_mesa_buffer_map'
 	print '\t_mesa_buffer_subdata'
-	print '\t_mesa_bzero'
-	print '\t_mesa_calloc'
 	print '\t_mesa_choose_tex_format'
 	print '\t_mesa_compressed_texture_size'
 	print '\t_mesa_create_framebuffer'
@@ -128,7 +126,6 @@
 	print '\t_mesa_enable_1_5_extensions'
 	print '\t_mesa_enable_sw_extensions'
 	print '\t_mesa_error'
-	print '\t_mesa_free'
 	print '\t_mesa_free_context_data'
 	print '\t_mesa_get_current_context'
 	print '\t_mesa_init_default_imports'
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index e36137d..3a1fd37 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -130,7 +130,7 @@
    (void) ctx;
    unbind_array_object_vbos(ctx, obj);
    _glthread_DESTROY_MUTEX(obj->Mutex);
-   _mesa_free(obj);
+   free(obj);
 }
 
 
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 44dc3b8..9a32bc3 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1559,8 +1559,8 @@
          }
 
          next = attr->next;
-         _mesa_free(attr->data);
-         _mesa_free(attr);
+         free(attr->data);
+         free(attr);
          attr = next;
       }
    }
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 2e9793e..816465c 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -208,14 +208,14 @@
    (void) ctx;
 
    if (bufObj->Data)
-      _mesa_free(bufObj->Data);
+      free(bufObj->Data);
 
    /* assign strange values here to help w/ debugging */
    bufObj->RefCount = -1000;
    bufObj->Name = ~0;
 
    _glthread_DESTROY_MUTEX(bufObj->Mutex);
-   _mesa_free(bufObj);
+   free(bufObj);
 }
 
 
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 1c12fb0..7858131 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -407,8 +407,8 @@
       _mesa_free_colortable_data(table);
 
       if (width > 0) {
-         table->TableF = (GLfloat *) _mesa_malloc(comps * width * sizeof(GLfloat));
-         table->TableUB = (GLubyte *) _mesa_malloc(comps * width * sizeof(GLubyte));
+         table->TableF = (GLfloat *) malloc(comps * width * sizeof(GLfloat));
+         table->TableUB = (GLubyte *) malloc(comps * width * sizeof(GLubyte));
 
 	 if (!table->TableF || !table->TableUB) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
@@ -1095,11 +1095,11 @@
 _mesa_free_colortable_data( struct gl_color_table *p )
 {
    if (p->TableF) {
-      _mesa_free(p->TableF);
+      free(p->TableF);
       p->TableF = NULL;
    }
    if (p->TableUB) {
-      _mesa_free(p->TableUB);
+      free(p->TableUB);
       p->TableUB = NULL;
    }
 }
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index f315f0b..4ecbb5e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -222,7 +222,7 @@
                      GLint accumAlphaBits,
                      GLint numSamples )
 {
-   GLvisual *vis = (GLvisual *) _mesa_calloc(sizeof(GLvisual));
+   GLvisual *vis = (GLvisual *) calloc(1, sizeof(GLvisual));
    if (vis) {
       if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag,
                                    redBits, greenBits, blueBits, alphaBits,
@@ -230,7 +230,7 @@
                                    accumRedBits, accumGreenBits,
                                    accumBlueBits, accumAlphaBits,
                                    numSamples)) {
-         _mesa_free(vis);
+         free(vis);
          return NULL;
       }
    }
@@ -320,7 +320,7 @@
 void
 _mesa_destroy_visual( GLvisual *vis )
 {
-   _mesa_free(vis);
+   free(vis);
 }
 
 /*@}*/
@@ -755,7 +755,7 @@
    GLint numEntries = MAX2(_glapi_get_dispatch_table_size(),
                            sizeof(struct _glapi_table) / sizeof(_glapi_proc));
    struct _glapi_table *table =
-      (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc));
+      (struct _glapi_table *) malloc(numEntries * sizeof(_glapi_proc));
    if (table) {
       _glapi_proc *entry = (_glapi_proc *) table;
       GLint i;
@@ -850,7 +850,7 @@
    if (!ctx->Exec || !ctx->Save) {
       _mesa_release_shared_state(ctx, ctx->Shared);
       if (ctx->Exec)
-         _mesa_free(ctx->Exec);
+         free(ctx->Exec);
       return GL_FALSE;
    }
 #if FEATURE_dispatch
@@ -913,7 +913,7 @@
    ASSERT(visual);
    /*ASSERT(driverContext);*/
 
-   ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext));
+   ctx = (GLcontext *) calloc(1, sizeof(GLcontext));
    if (!ctx)
       return NULL;
 
@@ -922,7 +922,7 @@
       return ctx;
    }
    else {
-      _mesa_free(ctx);
+      free(ctx);
       return NULL;
    }
 }
@@ -989,8 +989,8 @@
 #endif
 
    /* free dispatch tables */
-   _mesa_free(ctx->Exec);
-   _mesa_free(ctx->Save);
+   free(ctx->Exec);
+   free(ctx->Save);
 
    /* Shared context state (display lists, textures, etc) */
    _mesa_release_shared_state( ctx, ctx->Shared );
@@ -999,10 +999,10 @@
    _mesa_free_display_list_data(ctx);
 
    if (ctx->Extensions.String)
-      _mesa_free((void *) ctx->Extensions.String);
+      free((void *) ctx->Extensions.String);
 
    if (ctx->VersionString)
-      _mesa_free(ctx->VersionString);
+      free(ctx->VersionString);
 
    /* unbind the context if it's currently bound */
    if (ctx == _mesa_get_current_context()) {
@@ -1023,7 +1023,7 @@
 {
    if (ctx) {
       _mesa_free_context_data(ctx);
-      _mesa_free( (void *) ctx );
+      free( (void *) ctx );
    }
 }
 
diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c
index 79fcbc7..35de69b 100644
--- a/src/mesa/main/cpuinfo.c
+++ b/src/mesa/main/cpuinfo.c
@@ -43,7 +43,7 @@
 /**
  * Return a string describing the CPU architexture and extensions that
  * Mesa is using (such as SSE or Altivec).
- * \return information string, free it with _mesa_free()
+ * \return information string, free it with free()
  */
 char *
 _mesa_get_cpu_string(void)
@@ -51,7 +51,7 @@
 #define MAX_STRING 50
    char *buffer;
 
-   buffer = (char *) _mesa_malloc(MAX_STRING);
+   buffer = (char *) malloc(MAX_STRING);
    if (!buffer)
       return NULL;
 
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index f2182c0..79b63e9 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -303,7 +303,7 @@
       GLubyte *buffer;
       char s[100];
 
-      buffer = (GLubyte *) _mesa_malloc(img->Width * img->Height
+      buffer = (GLubyte *) malloc(img->Width * img->Height
                                         * img->Depth * 4);
 
       store = ctx->Pack; /* save */
@@ -321,7 +321,7 @@
 
       ctx->Pack = store; /* restore */
 
-      _mesa_free(buffer);
+      free(buffer);
    }
 }
 
@@ -350,7 +350,7 @@
       return;
    }
 
-   buffer = (GLubyte *) _mesa_malloc(rb->Width * rb->Height * 4);
+   buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4);
 
    ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
                           format, type, &ctx->DefaultPacking, buffer);
@@ -361,7 +361,7 @@
    _mesa_printf("  Writing renderbuffer image to %s\n", s);
    write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE);
 
-   _mesa_free(buffer);
+   free(buffer);
 }
 
 
@@ -481,7 +481,7 @@
    const GLuint h = ctx->DrawBuffer->Height;
    GLubyte *buf;
 
-   buf = (GLubyte *) _mesa_malloc(w * h * 4);
+   buf = (GLubyte *) malloc(w * h * 4);
 
    _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
    _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -499,7 +499,7 @@
 
    _mesa_PopClientAttrib();
 
-   _mesa_free(buf);
+   free(buf);
 }
 
 
@@ -513,8 +513,8 @@
    GLubyte *buf2;
    GLuint i;
 
-   buf = (GLuint *) _mesa_malloc(w * h * 4);  /* 4 bpp */
-   buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */
+   buf = (GLuint *) malloc(w * h * 4);  /* 4 bpp */
+   buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
 
    _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
    _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -534,8 +534,8 @@
 
    _mesa_PopClientAttrib();
 
-   _mesa_free(buf);
-   _mesa_free(buf2);
+   free(buf);
+   free(buf2);
 }
 
 
@@ -549,8 +549,8 @@
    GLubyte *buf2;
    GLuint i;
 
-   buf = (GLubyte *) _mesa_malloc(w * h);  /* 1 bpp */
-   buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */
+   buf = (GLubyte *) malloc(w * h);  /* 1 bpp */
+   buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
 
    _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
    _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -569,8 +569,8 @@
 
    _mesa_PopClientAttrib();
 
-   _mesa_free(buf);
-   _mesa_free(buf2);
+   free(buf);
+   free(buf2);
 }
 
 
diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c
index 49946a6..892520b 100644
--- a/src/mesa/main/depthstencil.c
+++ b/src/mesa/main/depthstencil.c
@@ -65,7 +65,7 @@
    ASSERT(rb->Format == MESA_FORMAT_Z24_S8 ||
           rb->Format == MESA_FORMAT_S8_Z24);
    _mesa_reference_renderbuffer(&rb->Wrapped, NULL);
-   _mesa_free(rb);
+   free(rb);
 }
 
 
@@ -818,5 +818,5 @@
       }
       stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL);
    }
-   _mesa_free(data);
+   free(data);
 }
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 740ebfe..87b8dda 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -472,7 +472,7 @@
 {
    struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
    dlist->Name = name;
-   dlist->Head = (Node *) _mesa_malloc(sizeof(Node) * count);
+   dlist->Head = (Node *) malloc(sizeof(Node) * count);
    dlist->Head[0].opcode = OPCODE_END_OF_LIST;
    return dlist;
 }
@@ -557,108 +557,108 @@
          switch (opcode) {
             /* for some commands, we need to free malloc'd memory */
          case OPCODE_MAP1:
-            _mesa_free(n[6].data);
+            free(n[6].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_MAP2:
-            _mesa_free(n[10].data);
+            free(n[10].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_DRAW_PIXELS:
-            _mesa_free(n[5].data);
+            free(n[5].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_BITMAP:
-            _mesa_free(n[7].data);
+            free(n[7].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COLOR_TABLE:
-            _mesa_free(n[6].data);
+            free(n[6].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COLOR_SUB_TABLE:
-            _mesa_free(n[6].data);
+            free(n[6].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_CONVOLUTION_FILTER_1D:
-            _mesa_free(n[6].data);
+            free(n[6].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_CONVOLUTION_FILTER_2D:
-            _mesa_free(n[7].data);
+            free(n[7].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_POLYGON_STIPPLE:
-            _mesa_free(n[1].data);
+            free(n[1].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_TEX_IMAGE1D:
-            _mesa_free(n[8].data);
+            free(n[8].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_TEX_IMAGE2D:
-            _mesa_free(n[9].data);
+            free(n[9].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_TEX_IMAGE3D:
-            _mesa_free(n[10].data);
+            free(n[10].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_TEX_SUB_IMAGE1D:
-            _mesa_free(n[7].data);
+            free(n[7].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_TEX_SUB_IMAGE2D:
-            _mesa_free(n[9].data);
+            free(n[9].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_TEX_SUB_IMAGE3D:
-            _mesa_free(n[11].data);
+            free(n[11].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COMPRESSED_TEX_IMAGE_1D:
-            _mesa_free(n[7].data);
+            free(n[7].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COMPRESSED_TEX_IMAGE_2D:
-            _mesa_free(n[8].data);
+            free(n[8].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COMPRESSED_TEX_IMAGE_3D:
-            _mesa_free(n[9].data);
+            free(n[9].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
-            _mesa_free(n[7].data);
+            free(n[7].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
-            _mesa_free(n[9].data);
+            free(n[9].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
-            _mesa_free(n[11].data);
+            free(n[11].data);
             n += InstSize[n[0].opcode];
             break;
 #if FEATURE_NV_vertex_program
          case OPCODE_LOAD_PROGRAM_NV:
-            _mesa_free(n[4].data);      /* program string */
+            free(n[4].data);      /* program string */
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
-            _mesa_free(n[2].data);      /* array of program ids */
+            free(n[2].data);      /* array of program ids */
             n += InstSize[n[0].opcode];
             break;
 #endif
 #if FEATURE_NV_fragment_program
          case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
-            _mesa_free(n[3].data);      /* parameter name */
+            free(n[3].data);      /* parameter name */
             n += InstSize[n[0].opcode];
             break;
 #endif
 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
          case OPCODE_PROGRAM_STRING_ARB:
-            _mesa_free(n[4].data);      /* program string */
+            free(n[4].data);      /* program string */
             n += InstSize[n[0].opcode];
             break;
 #endif
@@ -670,7 +670,7 @@
          case OPCODE_UNIFORM_2IV:
          case OPCODE_UNIFORM_3IV:
          case OPCODE_UNIFORM_4IV:
-            _mesa_free(n[3].data);
+            free(n[3].data);
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_UNIFORM_MATRIX22:
@@ -682,17 +682,17 @@
          case OPCODE_UNIFORM_MATRIX32:
          case OPCODE_UNIFORM_MATRIX34:
          case OPCODE_UNIFORM_MATRIX43:
-            _mesa_free(n[4].data);
+            free(n[4].data);
             n += InstSize[n[0].opcode];
             break;
 
          case OPCODE_CONTINUE:
             n = (Node *) n[1].next;
-            _mesa_free(block);
+            free(block);
             block = n;
             break;
          case OPCODE_END_OF_LIST:
-            _mesa_free(block);
+            free(block);
             done = GL_TRUE;
             break;
          default:
@@ -703,7 +703,7 @@
       }
    }
 
-   _mesa_free(dlist);
+   free(dlist);
 }
 
 
@@ -869,7 +869,7 @@
       Node *newblock;
       n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
       n[0].opcode = OPCODE_CONTINUE;
-      newblock = (Node *) _mesa_malloc(sizeof(Node) * BLOCK_SIZE);
+      newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE);
       if (!newblock) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
          return NULL;
@@ -2912,7 +2912,7 @@
    if (n) {
       n[1].e = map;
       n[2].i = mapsize;
-      n[3].data = (void *) _mesa_malloc(mapsize * sizeof(GLfloat));
+      n[3].data = (void *) malloc(mapsize * sizeof(GLfloat));
       memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat));
    }
    if (ctx->ExecuteFlag) {
@@ -4360,7 +4360,7 @@
       GLvoid *image;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       /* make copy of image */
-      image = _mesa_malloc(imageSize);
+      image = malloc(imageSize);
       if (!image) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB");
          return;
@@ -4377,7 +4377,7 @@
          n[7].data = image;
       }
       else if (image) {
-         _mesa_free(image);
+         free(image);
       }
       if (ctx->ExecuteFlag) {
          CALL_CompressedTexImage1DARB(ctx->Exec,
@@ -4406,7 +4406,7 @@
       GLvoid *image;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       /* make copy of image */
-      image = _mesa_malloc(imageSize);
+      image = malloc(imageSize);
       if (!image) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
          return;
@@ -4424,7 +4424,7 @@
          n[8].data = image;
       }
       else if (image) {
-         _mesa_free(image);
+         free(image);
       }
       if (ctx->ExecuteFlag) {
          CALL_CompressedTexImage2DARB(ctx->Exec,
@@ -4453,7 +4453,7 @@
       GLvoid *image;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       /* make copy of image */
-      image = _mesa_malloc(imageSize);
+      image = malloc(imageSize);
       if (!image) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB");
          return;
@@ -4472,7 +4472,7 @@
          n[9].data = image;
       }
       else if (image) {
-         _mesa_free(image);
+         free(image);
       }
       if (ctx->ExecuteFlag) {
          CALL_CompressedTexImage3DARB(ctx->Exec,
@@ -4496,7 +4496,7 @@
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
    /* make copy of image */
-   image = _mesa_malloc(imageSize);
+   image = malloc(imageSize);
    if (!image) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB");
       return;
@@ -4513,7 +4513,7 @@
       n[7].data = image;
    }
    else if (image) {
-      _mesa_free(image);
+      free(image);
    }
    if (ctx->ExecuteFlag) {
       CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
@@ -4536,7 +4536,7 @@
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
    /* make copy of image */
-   image = _mesa_malloc(imageSize);
+   image = malloc(imageSize);
    if (!image) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB");
       return;
@@ -4555,7 +4555,7 @@
       n[9].data = image;
    }
    else if (image) {
-      _mesa_free(image);
+      free(image);
    }
    if (ctx->ExecuteFlag) {
       CALL_CompressedTexSubImage2DARB(ctx->Exec,
@@ -4578,7 +4578,7 @@
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
    /* make copy of image */
-   image = _mesa_malloc(imageSize);
+   image = malloc(imageSize);
    if (!image) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB");
       return;
@@ -4599,7 +4599,7 @@
       n[11].data = image;
    }
    else if (image) {
-      _mesa_free(image);
+      free(image);
    }
    if (ctx->ExecuteFlag) {
       CALL_CompressedTexSubImage3DARB(ctx->Exec,
@@ -4788,7 +4788,7 @@
 
    n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
    if (n) {
-      GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
+      GLubyte *programCopy = (GLubyte *) malloc(len);
       if (!programCopy) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
          return;
@@ -4815,7 +4815,7 @@
 
    n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
    if (n) {
-      GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
+      GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint));
       if (!idCopy) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
          return;
@@ -4986,7 +4986,7 @@
 
    n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
    if (n) {
-      GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
+      GLubyte *nameCopy = (GLubyte *) malloc(len);
       if (!nameCopy) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
          return;
@@ -5085,7 +5085,7 @@
 
    n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
    if (n) {
-      GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
+      GLubyte *programCopy = (GLubyte *) malloc(len);
       if (!programCopy) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
          return;
@@ -6199,7 +6199,7 @@
 static void *
 memdup(const void *src, GLsizei bytes)
 {
-   void *b = bytes >= 0 ? _mesa_malloc(bytes) : NULL;
+   void *b = bytes >= 0 ? malloc(bytes) : NULL;
    if (b)
       memcpy(b, src, bytes);
    return b;
diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
index 4c61399..07a7f9f 100644
--- a/src/mesa/main/execmem.c
+++ b/src/mesa/main/execmem.c
@@ -140,14 +140,14 @@
 void *
 _mesa_exec_malloc(GLuint size)
 {
-   return _mesa_malloc( size );
+   return malloc( size );
 }
 
  
 void 
 _mesa_exec_free(void *addr)
 {
-   _mesa_free(addr);
+   free(addr);
 }
 
 
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index f24baf5..2c1120e 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -576,7 +576,7 @@
 {
    const GLuint aLen = a ? strlen(a) : 0;
    const GLuint bLen = b ? strlen(b) : 0;
-   char *s = _mesa_calloc(aLen + bLen + 1);
+   char *s = calloc(1, aLen + bLen + 1);
    if (s) {
       if (a)
          memcpy(s, a, aLen);
@@ -585,7 +585,7 @@
       s[aLen + bLen] = '\0';
    }
    if (a)
-      _mesa_free((void *) a);
+      free((void *) a);
    return s;
 }
 
@@ -685,7 +685,7 @@
       extStrLen += strlen(extraExt) + 1; /* +1 for space */
 
    /* allocate the extension string */
-   s = (char *) _mesa_malloc(extStrLen);
+   s = (char *) malloc(extStrLen);
    if (!s)
       return NULL;
 
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 41b5420..065e25f 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -192,7 +192,7 @@
 {
    if (fb) {
       _mesa_free_framebuffer_data(fb);
-      _mesa_free(fb);
+      free(fb);
    }
 }
 
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index fdfbe6b..9757754 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -108,13 +108,13 @@
             _mesa_problem(NULL,
                           "In _mesa_DeleteHashTable, found non-freed data");
          }
-	 _mesa_free(entry);
+	 free(entry);
 	 entry = next;
       }
    }
    _glthread_DESTROY_MUTEX(table->Mutex);
    _glthread_DESTROY_MUTEX(table->WalkMutex);
-   _mesa_free(table);
+   free(table);
 }
 
 
@@ -245,7 +245,7 @@
          else {
             table->Table[pos] = entry->Next;
          }
-         _mesa_free(entry);
+         free(entry);
          _glthread_UNLOCK_MUTEX(table->Mutex);
 	 return;
       }
@@ -282,7 +282,7 @@
       for (entry = table->Table[pos]; entry; entry = next) {
          callback(entry->Key, entry->Data, userData);
          next = entry->Next;
-         _mesa_free(entry);
+         free(entry);
       }
       table->Table[pos] = NULL;
    }
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index bd03217..dc8d977 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1038,7 +1038,7 @@
                  | (p[3]      );
          p += 4;
       }
-      _mesa_free(ptrn);
+      free(ptrn);
    }
 }
 
@@ -1083,7 +1083,7 @@
 
    /* Alloc dest storage */
    bytes = ((width + 7) / 8 * height);
-   buffer = (GLubyte *) _mesa_malloc( bytes );
+   buffer = (GLubyte *) malloc( bytes );
    if (!buffer)
       return NULL;
 
@@ -1094,7 +1094,7 @@
          _mesa_image_address2d(packing, pixels, width, height,
                                GL_COLOR_INDEX, GL_BITMAP, row, 0);
       if (!src) {
-         _mesa_free(buffer);
+         free(buffer);
          return NULL;
       }
 
@@ -5232,7 +5232,7 @@
 
    {
       GLubyte *destBuffer
-         = (GLubyte *) _mesa_malloc(bytesPerRow * height * depth);
+         = (GLubyte *) malloc(bytesPerRow * height * depth);
       GLubyte *dst;
       GLint img, row;
       if (!destBuffer)
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 5c2c863..10224f7 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -71,27 +71,6 @@
 /** \name Memory */
 /*@{*/
 
-/** Wrapper around malloc() */
-void *
-_mesa_malloc(size_t bytes)
-{
-   return malloc(bytes);
-}
-
-/** Wrapper around calloc() */
-void *
-_mesa_calloc(size_t bytes)
-{
-   return calloc(1, bytes);
-}
-
-/** Wrapper around free() */
-void
-_mesa_free(void *ptr)
-{
-   free(ptr);
-}
-
 /**
  * Allocate aligned memory.
  *
@@ -118,7 +97,7 @@
 
    ASSERT( alignment > 0 );
 
-   ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *));
+   ptr = (uintptr_t) malloc(bytes + alignment + sizeof(void *));
    if (!ptr)
       return NULL;
 
@@ -138,8 +117,8 @@
 }
 
 /**
- * Same as _mesa_align_malloc(), but using _mesa_calloc() instead of
- * _mesa_malloc()
+ * Same as _mesa_align_malloc(), but using calloc(1, ) instead of
+ * malloc()
  */
 void *
 _mesa_align_calloc(size_t bytes, unsigned long alignment)
@@ -167,7 +146,7 @@
 
    ASSERT( alignment > 0 );
 
-   ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *));
+   ptr = (uintptr_t) calloc(1, bytes + alignment + sizeof(void *));
    if (!ptr)
       return NULL;
 
@@ -203,7 +182,7 @@
 #else
    void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
    void *realAddr = *cubbyHole;
-   _mesa_free(realAddr);
+   free(realAddr);
 #endif /* defined(HAVE_POSIX_MEMALIGN) */
 }
 
@@ -236,11 +215,11 @@
 _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
 {
    const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
-   void *newBuffer = _mesa_malloc(newSize);
+   void *newBuffer = malloc(newSize);
    if (newBuffer && oldBuffer && copySize > 0)
       memcpy(newBuffer, oldBuffer, copySize);
    if (oldBuffer)
-      _mesa_free(oldBuffer);
+      free(oldBuffer);
    return newBuffer;
 }
 
@@ -798,7 +777,7 @@
 /*@{*/
 
 /**
- * Implemented using _mesa_malloc() and strcpy.
+ * Implemented using malloc() and strcpy.
  * Note that NULL is handled accordingly.
  */
 char *
@@ -806,7 +785,7 @@
 {
    if (s) {
       size_t l = strlen(s);
-      char *s2 = (char *) _mesa_malloc(l + 1);
+      char *s2 = (char *) malloc(l + 1);
       if (s2)
          strcpy(s2, s);
       return s2;
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 106dd02..4eabdfd 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -50,15 +50,15 @@
 /*@{*/
 
 /** Allocate \p BYTES bytes */
-#define MALLOC(BYTES)      _mesa_malloc(BYTES)
+#define MALLOC(BYTES)      malloc(BYTES)
 /** Allocate and zero \p BYTES bytes */
-#define CALLOC(BYTES)      _mesa_calloc(BYTES)
+#define CALLOC(BYTES)      calloc(1, BYTES)
 /** Allocate a structure of type \p T */
-#define MALLOC_STRUCT(T)   (struct T *) _mesa_malloc(sizeof(struct T))
+#define MALLOC_STRUCT(T)   (struct T *) malloc(sizeof(struct T))
 /** Allocate and zero a structure of type \p T */
-#define CALLOC_STRUCT(T)   (struct T *) _mesa_calloc(sizeof(struct T))
+#define CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))
 /** Free memory */
-#define FREE(PTR)          _mesa_free(PTR)
+#define FREE(PTR)          free(PTR)
 
 /** Allocate \p BYTES aligned at \p N bytes */
 #define ALIGN_MALLOC(BYTES, N)     _mesa_align_malloc(BYTES, N)
@@ -508,15 +508,6 @@
  */
 
 extern void *
-_mesa_malloc( size_t bytes );
-
-extern void *
-_mesa_calloc( size_t bytes );
-
-extern void
-_mesa_free( void *ptr );
-
-extern void *
 _mesa_align_malloc( size_t bytes, unsigned long alignment );
 
 extern void *
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 654faa5..6899ed0 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1433,7 +1433,7 @@
 
    /* Free lighting shininess exponentiation table */
    foreach_s( s, tmps, ctx->_ShineTabList ) {
-      _mesa_free( s );
+      free( s );
    }
-   _mesa_free( ctx->_ShineTabList );
+   free( ctx->_ShineTabList );
 }
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 1da5763..415abcd 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1537,15 +1537,15 @@
       size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE)
          * srcImage->Width * srcImage->Height * srcImage->Depth + 20;
       /* 20 extra bytes, just be safe when calling last FetchTexel */
-      srcData = (GLubyte *) _mesa_malloc(size);
+      srcData = (GLubyte *) malloc(size);
       if (!srcData) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
          return;
       }
-      dstData = (GLubyte *) _mesa_malloc(size / 2);  /* 1/4 would probably be OK */
+      dstData = (GLubyte *) malloc(size / 2);  /* 1/4 would probably be OK */
       if (!dstData) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
-         _mesa_free((void *) srcData);
+         free((void *) srcData);
          return;
       }
 
@@ -1590,8 +1590,8 @@
       if (!nextLevel) {
          /* all done */
          if (_mesa_is_format_compressed(srcImage->TexFormat)) {
-            _mesa_free((void *) srcData);
-            _mesa_free(dstData);
+            free((void *) srcData);
+            free(dstData);
          }
          return;
       }
diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c
index d430bcd..3ef38e9 100644
--- a/src/mesa/main/mm.c
+++ b/src/mesa/main/mm.c
@@ -60,13 +60,13 @@
    if (!size) 
       return NULL;
 
-   heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
+   heap = (struct mem_block *) calloc(1, sizeof(struct mem_block));
    if (!heap) 
       return NULL;
    
-   block = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
+   block = (struct mem_block *) calloc(1, sizeof(struct mem_block));
    if (!block) {
-      _mesa_free(heap);
+      free(heap);
       return NULL;
    }
 
@@ -98,7 +98,7 @@
 
    /* break left  [p, newblock, p->next], then p = newblock */
    if (startofs > p->ofs) {
-      newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block));
+      newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
       if (!newblock)
 	 return NULL;
       newblock->ofs = startofs;
@@ -122,7 +122,7 @@
 
    /* break right, also [p, newblock, p->next] */
    if (size < p->size) {
-      newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block));
+      newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
       if (!newblock)
 	 return NULL;
       newblock->ofs = startofs + size;
@@ -225,7 +225,7 @@
       q->next_free->prev_free = q->prev_free; 
       q->prev_free->next_free = q->next_free;
      
-      _mesa_free(q);
+      free(q);
       return 1;
    }
    return 0;
@@ -270,9 +270,9 @@
 
    for (p = heap->next; p != heap; ) {
       struct mem_block *next = p->next;
-      _mesa_free(p);
+      free(p);
       p = next;
    }
 
-   _mesa_free(heap);
+   free(heap);
 }
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 387a82f..471352f 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -114,7 +114,7 @@
 static void
 _mesa_delete_query(GLcontext *ctx, struct gl_query_object *q)
 {
-   _mesa_free(q);
+   free(q);
 }
 
 
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index aec22d9..c44db25 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -1122,7 +1122,7 @@
 
    /* free old buffer storage */
    if (rb->Data) {
-      _mesa_free(rb->Data);
+      free(rb->Data);
       rb->Data = NULL;
    }
 
@@ -1179,10 +1179,10 @@
 
    /* next, resize my alpha buffer */
    if (arb->Data) {
-      _mesa_free(arb->Data);
+      free(arb->Data);
    }
 
-   arb->Data = _mesa_malloc(width * height * sizeof(GLubyte));
+   arb->Data = malloc(width * height * sizeof(GLubyte));
    if (arb->Data == NULL) {
       arb->Width = 0;
       arb->Height = 0;
@@ -1204,13 +1204,13 @@
 delete_renderbuffer_alpha8(struct gl_renderbuffer *arb)
 {
    if (arb->Data) {
-      _mesa_free(arb->Data);
+      free(arb->Data);
    }
    ASSERT(arb->Wrapped);
    ASSERT(arb != arb->Wrapped);
    arb->Wrapped->Delete(arb->Wrapped);
    arb->Wrapped = NULL;
-   _mesa_free(arb);
+   free(arb);
 }
 
 
@@ -1460,9 +1460,9 @@
 _mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
 {
    if (rb->Data) {
-      _mesa_free(rb->Data);
+      free(rb->Data);
    }
-   _mesa_free(rb);
+   free(rb);
 }
 
 
diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c
index 91f2a7a..e6f6add 100644
--- a/src/mesa/main/shaders.c
+++ b/src/mesa/main/shaders.c
@@ -434,7 +434,7 @@
     * This array holds offsets of where the appropriate string ends, thus the
     * last element will be set to the total length of the source code.
     */
-   offsets = (GLint *) _mesa_malloc(count * sizeof(GLint));
+   offsets = (GLint *) malloc(count * sizeof(GLint));
    if (offsets == NULL) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
       return;
@@ -442,7 +442,7 @@
 
    for (i = 0; i < count; i++) {
       if (string[i] == NULL) {
-         _mesa_free((GLvoid *) offsets);
+         free((GLvoid *) offsets);
          _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");
          return;
       }
@@ -460,9 +460,9 @@
     * valgrind warnings in the parser/grammer code.
     */
    totalLength = offsets[count - 1] + 2;
-   source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB));
+   source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB));
    if (source == NULL) {
-      _mesa_free((GLvoid *) offsets);
+      free((GLvoid *) offsets);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
       return;
    }
@@ -491,7 +491,7 @@
       if (newSource) {
          _mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
                        shaderObj, checksum, filename);
-         _mesa_free(source);
+         free(source);
          source = newSource;
       }
    }      
@@ -504,7 +504,7 @@
          sh->SourceChecksum = checksum; /* save original checksum */
    }
 
-   _mesa_free(offsets);
+   free(offsets);
 }
 
 
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index b889364..e364e24 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -362,7 +362,7 @@
    _glthread_DESTROY_MUTEX(shared->Mutex);
    _glthread_DESTROY_MUTEX(shared->TexMutex);
 
-   _mesa_free(shared);
+   free(shared);
 }
 
 
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index 36b48fd..1bff308 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -78,7 +78,7 @@
 _mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
 {
    (void) ctx;
-   _mesa_free(syncObj);
+   free(syncObj);
 }
 
 
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 73a31a1..71e40dd 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -105,7 +105,7 @@
                dst, dstRowStride);
 
    if (tempImage)
-      _mesa_free((void*) tempImage);
+      free((void*) tempImage);
 
    return GL_TRUE;
 }
@@ -162,7 +162,7 @@
                dst, dstRowStride);
 
    if (tempImage)
-      _mesa_free((void*) tempImage);
+      free((void*) tempImage);
 
    return GL_TRUE;
 }
@@ -1305,7 +1305,7 @@
    if ((width & 7) | (height & 3)) {
       GLint newWidth = (width + 7) & ~7;
       GLint newHeight = (height + 3) & ~3;
-      newSource = _mesa_malloc(comps * newWidth * newHeight * sizeof(GLchan));
+      newSource = malloc(comps * newWidth * newHeight * sizeof(GLchan));
       if (!newSource) {
          GET_CURRENT_CONTEXT(ctx);
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
@@ -1324,7 +1324,7 @@
    if (CHAN_TYPE != GL_UNSIGNED_BYTE) {
       const GLuint n = width * height * comps;
       const GLchan *src = (const GLchan *) source;
-      GLubyte *dest = (GLubyte *) _mesa_malloc(n * sizeof(GLubyte));
+      GLubyte *dest = (GLubyte *) malloc(n * sizeof(GLubyte));
       GLuint i;
       if (!dest) {
          GET_CURRENT_CONTEXT(ctx);
@@ -1335,7 +1335,7 @@
          dest[i] = CHAN_TO_UBYTE(src[i]);
       }
       if (newSource != NULL) {
-         _mesa_free(newSource);
+         free(newSource);
       }
       newSource = dest;  /* we'll free this buffer before returning */
       source = dest;  /* the new, GLubyte incoming image */
@@ -1361,7 +1361,7 @@
 
  cleanUp:
    if (newSource != NULL) {
-      _mesa_free(newSource);
+      free(newSource);
    }
 }
 
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index b271a53..fcd28a4 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -213,7 +213,7 @@
    }
 
    if (tempImage)
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
 
    return GL_TRUE;
 }
@@ -275,7 +275,7 @@
    }
 
    if (tempImage)
-      _mesa_free((void*) tempImage);
+      free((void*) tempImage);
 
    return GL_TRUE;
 }
@@ -336,7 +336,7 @@
    }
 
    if (tempImage)
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
 
    return GL_TRUE;
 }
@@ -397,7 +397,7 @@
    }
 
    if (tempImage)
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
 
    return GL_TRUE;
 }
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index da3c6f9..11e37dc 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -488,8 +488,8 @@
 
    ASSERT(texImage->Data == NULL);
    if (texImage->ImageOffsets)
-      _mesa_free(texImage->ImageOffsets);
-   _mesa_free(texImage);
+      free(texImage->ImageOffsets);
+   free(texImage);
 }
 
 
@@ -843,7 +843,7 @@
    img->Depth = 0;
    img->RowStride = 0;
    if (img->ImageOffsets) {
-      _mesa_free(img->ImageOffsets);
+      free(img->ImageOffsets);
       img->ImageOffsets = NULL;
    }
    img->Width2 = 0;
@@ -932,8 +932,8 @@
     * case code in the texstore routines.
     */
    if (img->ImageOffsets)
-      _mesa_free(img->ImageOffsets);
-   img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint));
+      free(img->ImageOffsets);
+   img->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint));
    for (i = 0; i < depth; i++) {
       img->ImageOffsets[i] = i * width * height;
    }
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 649f358..feba6e9 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -207,7 +207,7 @@
    _glthread_DESTROY_MUTEX(texObj->Mutex);
 
    /* free this object */
-   _mesa_free(texObj);
+   free(texObj);
 }
 
 
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index cf603d4..dbed51a 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -414,7 +414,7 @@
 delete_texture_wrapper(struct gl_renderbuffer *rb)
 {
    ASSERT(rb->RefCount == 0);
-   _mesa_free(rb);
+   free(rb);
 }
 
 
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index ab572a1..bd63c77 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -347,16 +347,16 @@
       GLfloat *convImage;
 
       /* pre-convolution image buffer (3D) */
-      tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+      tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
                                            * 4 * sizeof(GLfloat));
       if (!tempImage)
          return NULL;
 
       /* post-convolution image buffer (2D) */
-      convImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight
+      convImage = (GLfloat *) malloc(srcWidth * srcHeight
                                            * 4 * sizeof(GLfloat));
       if (!convImage) {
-         _mesa_free(tempImage);
+         free(tempImage);
          return NULL;
       }
 
@@ -419,7 +419,7 @@
          }
       } /* loop over 3D image slices */
 
-      _mesa_free(convImage);
+      free(convImage);
 
       /* might need these below */
       srcWidth = convWidth;
@@ -433,7 +433,7 @@
       GLfloat *dst;
       GLint img, row;
 
-      tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+      tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
                                            * components * sizeof(GLfloat));
       if (!tempImage)
          return NULL;
@@ -472,10 +472,10 @@
        */
       ASSERT(texComponents >= logComponents);
 
-      newImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+      newImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
                                           * texComponents * sizeof(GLfloat));
       if (!newImage) {
-         _mesa_free(tempImage);
+         free(tempImage);
          return NULL;
       }
 
@@ -495,7 +495,7 @@
          }
       }
 
-      _mesa_free(tempImage);
+      free(tempImage);
       tempImage = newImage;
    }
 
@@ -582,11 +582,11 @@
 #endif
 
    /* unpack and transfer the source image */
-   tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+   tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
                                        * components * sizeof(GLchan));
    if (!tempImage) {
       if (freeSrcImage) {
-         _mesa_free((void *) srcAddr);
+         free((void *) srcAddr);
       }
       return NULL;
    }
@@ -611,7 +611,7 @@
 
    /* If we made a temporary image for convolution, free it here */
    if (freeSrcImage) {
-      _mesa_free((void *) srcAddr);
+      free((void *) srcAddr);
    }
 
    if (logicalBaseFormat != textureBaseFormat) {
@@ -631,10 +631,10 @@
        */
       ASSERT(texComponents >= logComponents);
 
-      newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+      newImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
                                          * texComponents * sizeof(GLchan));
       if (!newImage) {
-         _mesa_free(tempImage);
+         free(tempImage);
          return NULL;
       }
 
@@ -654,7 +654,7 @@
          }
       }
 
-      _mesa_free(tempImage);
+      free(tempImage);
       tempImage = newImage;
    }
 
@@ -1267,7 +1267,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -1395,7 +1395,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -1606,7 +1606,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -1733,7 +1733,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -1841,7 +1841,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -1912,7 +1912,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -1970,7 +1970,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2040,7 +2040,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2143,7 +2143,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2218,7 +2218,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2273,7 +2273,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2360,7 +2360,7 @@
             src += srcWidth;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2518,7 +2518,7 @@
       GLbyte *tempImage, *dst, *src;
       GLint row;
 
-      tempImage = (GLbyte *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+      tempImage = (GLbyte *) malloc(srcWidth * srcHeight * srcDepth
                                           * components * sizeof(GLbyte));
       if (!tempImage)
          return GL_FALSE;
@@ -2546,7 +2546,7 @@
          dst += dstRowStride;
          src += srcWidth * texelBytes;
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2667,7 +2667,7 @@
             dstRow += dstRowStride;
          }
       }
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2925,7 +2925,7 @@
          }
       }
 
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
@@ -2996,7 +2996,7 @@
          }
       }
 
-      _mesa_free((void *) tempImage);
+      free((void *) tempImage);
    }
    return GL_TRUE;
 }
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 9d23c577..e474fe7 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -122,7 +122,7 @@
 
    compute_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
    
-   ctx->VersionString = (char *) _mesa_malloc(max);
+   ctx->VersionString = (char *) malloc(max);
    if (ctx->VersionString) {
       _mesa_snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING,
                      ctx->VersionMajor, ctx->VersionMinor);
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index bdd26b7..03ff30a 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -85,7 +85,7 @@
    }
 
    if (program->Base.String != NULL)
-      _mesa_free(program->Base.String);
+      free(program->Base.String);
 
    /* Copy the relevant contents of the arb_program struct into the
     * fragment_program struct.
@@ -130,7 +130,7 @@
       program->Base.InputsRead |= FRAG_BIT_FOGC;
 
    if (program->Base.Instructions)
-      _mesa_free(program->Base.Instructions);
+      free(program->Base.Instructions);
    program->Base.Instructions = prog.Instructions;
 
    if (program->Base.Parameters)
@@ -181,7 +181,7 @@
    }
 
    if (program->Base.String != NULL)
-      _mesa_free(program->Base.String);
+      free(program->Base.String);
 
    /* Copy the relevant contents of the arb_program struct into the 
     * vertex_program struct.
@@ -203,7 +203,7 @@
       ? GL_TRUE : GL_FALSE;
 
    if (program->Base.Instructions)
-      _mesa_free(program->Base.Instructions);
+      free(program->Base.Instructions);
    program->Base.Instructions = prog.Instructions;
 
    if (program->Base.Parameters)
diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c
index fb2fa4b..870f77e 100644
--- a/src/mesa/shader/atifragshader.c
+++ b/src/mesa/shader/atifragshader.c
@@ -60,11 +60,11 @@
    GLuint i;
    for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
       if (s->Instructions[i])
-         _mesa_free(s->Instructions[i]);
+         free(s->Instructions[i]);
       if (s->SetupInst[i])
-         _mesa_free(s->SetupInst[i]);
+         free(s->SetupInst[i]);
    }
-   _mesa_free(s);
+   free(s);
 }
 
 
@@ -293,7 +293,7 @@
       if (prog) {
 	 prog->RefCount--;
 	 if (prog->RefCount <= 0) {
-	    _mesa_free(prog);
+	    free(prog);
 	 }
       }
    }
@@ -318,9 +318,9 @@
    /* no idea if it's allowed to redefine a shader */
    for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
          if (ctx->ATIFragmentShader.Current->Instructions[i])
-            _mesa_free(ctx->ATIFragmentShader.Current->Instructions[i]);
+            free(ctx->ATIFragmentShader.Current->Instructions[i]);
          if (ctx->ATIFragmentShader.Current->SetupInst[i])
-            _mesa_free(ctx->ATIFragmentShader.Current->SetupInst[i]);
+            free(ctx->ATIFragmentShader.Current->SetupInst[i]);
    }
 
    /* malloc the instructions here - not sure if the best place but its
@@ -328,11 +328,11 @@
    for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
       ctx->ATIFragmentShader.Current->Instructions[i] =
 	 (struct atifs_instruction *)
-	 _mesa_calloc(sizeof(struct atifs_instruction) *
+	 calloc(1, sizeof(struct atifs_instruction) *
 		   (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI));
       ctx->ATIFragmentShader.Current->SetupInst[i] =
 	 (struct atifs_setupinst *)
-	 _mesa_calloc(sizeof(struct atifs_setupinst) *
+	 calloc(1, sizeof(struct atifs_setupinst) *
 		   (MAX_NUM_FRAGMENT_REGISTERS_ATI));
    }
 
diff --git a/src/mesa/shader/hash_table.c b/src/mesa/shader/hash_table.c
index e89a256..fa6ba2b 100644
--- a/src/mesa/shader/hash_table.c
+++ b/src/mesa/shader/hash_table.c
@@ -65,7 +65,7 @@
         num_buckets = 16;
     }
 
-    ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1) 
+    ht = malloc(sizeof(*ht) + ((num_buckets - 1) 
 				     * sizeof(ht->buckets[0])));
     if (ht != NULL) {
         ht->hash = hash;
@@ -85,7 +85,7 @@
 hash_table_dtor(struct hash_table *ht)
 {
    hash_table_clear(ht);
-   _mesa_free(ht);
+   free(ht);
 }
 
 
@@ -100,7 +100,7 @@
    for (i = 0; i < ht->num_buckets; i++) {
       foreach_s(node, temp, & ht->buckets[i]) {
 	 remove_from_list(node);
-	 _mesa_free(node);
+	 free(node);
       }
 
       assert(is_empty_list(& ht->buckets[i]));
@@ -134,7 +134,7 @@
     const unsigned bucket = hash_value % ht->num_buckets;
     struct hash_node *node;
 
-    node = _mesa_calloc(sizeof(*node));
+    node = calloc(1, sizeof(*node));
 
     node->data = data;
     node->key = key;
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 639408d..4f02703 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -171,7 +171,7 @@
    _mesa_debug(parseState->ctx,
                "nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
                lineNo, line, column, (char *) lineStr, msg);
-   _mesa_free((void *) lineStr);
+   free((void *) lineStr);
 #else
    (void) lineNo;
 #endif
@@ -1231,7 +1231,7 @@
    for (len = 0; str[len] != '\''; len++) /* find closing quote */
       ;
    parseState->pos += len + 1;
-   msg = (GLubyte*) _mesa_malloc(len + 1);
+   msg = (GLubyte*) malloc(len + 1);
 
    memcpy(msg, str, len);
    msg[len] = 0;
@@ -1548,7 +1548,7 @@
       program->Base.String = programString;
       program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
       if (program->Base.Instructions) {
-         _mesa_free(program->Base.Instructions);
+         free(program->Base.Instructions);
       }
       program->Base.Instructions = newInst;
       program->Base.NumInstructions = parseState.numInst;
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index 3656438..fb36303 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -82,7 +82,7 @@
    _mesa_debug(parseState->ctx,
                "nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
                lineNo, line, column, (char *) lineStr, msg);
-   _mesa_free((void *) lineStr);
+   free((void *) lineStr);
 #else
    (void) lineNo;
 #endif
@@ -1048,7 +1048,7 @@
    for (len = 0; str[len] != '\''; len++) /* find closing quote */
       ;
    parseState->pos += len + 1;
-   msg = (GLubyte*) _mesa_malloc(len + 1);
+   msg = (GLubyte*) malloc(len + 1);
 
    memcpy(msg, str, len);
    msg[len] = 0;
@@ -1372,7 +1372,7 @@
       newInst = _mesa_alloc_instructions(parseState.numInst);
       if (!newInst) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
-         _mesa_free(programString);
+         free(programString);
          return;  /* out of memory */
       }
       _mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
@@ -1380,12 +1380,12 @@
       /* install the program */
       program->Base.Target = target;
       if (program->Base.String) {
-         _mesa_free(program->Base.String);
+         free(program->Base.String);
       }
       program->Base.String = programString;
       program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
       if (program->Base.Instructions) {
-         _mesa_free(program->Base.Instructions);
+         free(program->Base.Instructions);
       }
       program->Base.Instructions = newInst;
       program->Base.InputsRead = parseState.inputsRead;
diff --git a/src/mesa/shader/prog_cache.c b/src/mesa/shader/prog_cache.c
index 8e54f3a..e5b602f 100644
--- a/src/mesa/shader/prog_cache.c
+++ b/src/mesa/shader/prog_cache.c
@@ -87,7 +87,7 @@
    cache->last = NULL;
 
    size = cache->size * 3;
-   items = (struct cache_item**) _mesa_malloc(size * sizeof(*items));
+   items = (struct cache_item**) malloc(size * sizeof(*items));
    memset(items, 0, size * sizeof(*items));
 
    for (i = 0; i < cache->size; i++)
@@ -97,7 +97,7 @@
 	 items[c->hash % size] = c;
       }
 
-   _mesa_free(cache->items);
+   free(cache->items);
    cache->items = items;
    cache->size = size;
 }
@@ -114,9 +114,9 @@
    for (i = 0; i < cache->size; i++) {
       for (c = cache->items[i]; c; c = next) {
 	 next = c->next;
-	 _mesa_free(c->key);
+	 free(c->key);
          _mesa_reference_program(ctx, &c->program, NULL);
-	 _mesa_free(c);
+	 free(c);
       }
       cache->items[i] = NULL;
    }
@@ -134,9 +134,9 @@
    if (cache) {
       cache->size = 17;
       cache->items = (struct cache_item **)
-         _mesa_calloc(cache->size * sizeof(struct cache_item));
+         calloc(1, cache->size * sizeof(struct cache_item));
       if (!cache->items) {
-         _mesa_free(cache);
+         free(cache);
          return NULL;
       }
    }
@@ -148,8 +148,8 @@
 _mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *cache)
 {
    clear_cache(ctx, cache);
-   _mesa_free(cache->items);
-   _mesa_free(cache);
+   free(cache->items);
+   free(cache);
 }
 
 
@@ -188,7 +188,7 @@
 
    c->hash = hash;
 
-   c->key = _mesa_malloc(keysize);
+   c->key = malloc(keysize);
    memcpy(c->key, key, keysize);
 
    c->program = program;  /* no refcount change */
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index 0c4da4d..81099cb 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -70,7 +70,7 @@
 _mesa_alloc_instructions(GLuint numInst)
 {
    return (struct prog_instruction *)
-      _mesa_calloc(numInst * sizeof(struct prog_instruction));
+      calloc(1, numInst * sizeof(struct prog_instruction));
 }
 
 
@@ -128,11 +128,11 @@
    GLuint i;
    for (i = 0; i < count; i++) {
       if (inst[i].Data)
-         _mesa_free(inst[i].Data);
+         free(inst[i].Data);
       if (inst[i].Comment)
-         _mesa_free((char *) inst[i].Comment);
+         free((char *) inst[i].Comment);
    }
-   _mesa_free(inst);
+   free(inst);
 }
 
 
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index e1ec522..09816d5 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -237,7 +237,7 @@
    }
 
    removeInst = (GLboolean *)
-      _mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
+      calloc(1, prog->NumInstructions * sizeof(GLboolean));
 
    /* Determine which temps are read and written */
    for (i = 0; i < prog->NumInstructions; i++) {
@@ -347,7 +347,7 @@
    }
 
 done:
-   _mesa_free(removeInst);
+   free(removeInst);
 }
 
 
@@ -538,7 +538,7 @@
    }
 
    removeInst = (GLboolean *)
-      _mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
+      calloc(1, prog->NumInstructions * sizeof(GLboolean));
 
    /*
     * Look for sequences such as this:
@@ -621,7 +621,7 @@
    /* now remove the instructions which aren't needed */
    rem = remove_instructions(prog, removeInst);
 
-   _mesa_free(removeInst);
+   free(removeInst);
 
    if (dbg) {
       _mesa_printf("Optimize: End remove extra moves.  %u instructions removed\n", rem);
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 1feb7bd..25bb4f3 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -54,16 +54,16 @@
 
       /* alloc arrays */
       p->Parameters = (struct gl_program_parameter *)
-	 _mesa_calloc(size * sizeof(struct gl_program_parameter));
+	 calloc(1, size * sizeof(struct gl_program_parameter));
 
       p->ParameterValues = (GLfloat (*)[4])
          _mesa_align_malloc(size * 4 *sizeof(GLfloat), 16);
 
 
       if ((p->Parameters == NULL) || (p->ParameterValues == NULL)) {
-	 _mesa_free(p->Parameters);
+	 free(p->Parameters);
 	 _mesa_align_free(p->ParameterValues);
-	 _mesa_free(p);
+	 free(p);
 	 p = NULL;
       }
    }
@@ -81,12 +81,12 @@
    GLuint i;
    for (i = 0; i < paramList->NumParameters; i++) {
       if (paramList->Parameters[i].Name)
-	 _mesa_free((void *) paramList->Parameters[i].Name);
+	 free((void *) paramList->Parameters[i].Name);
    }
-   _mesa_free(paramList->Parameters);
+   free(paramList->Parameters);
    if (paramList->ParameterValues)
       _mesa_align_free(paramList->ParameterValues);
-   _mesa_free(paramList);
+   free(paramList);
 }
 
 
@@ -486,7 +486,7 @@
    paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
 
    /* free name string here since we duplicated it in add_parameter() */
-   _mesa_free(name);
+   free(name);
 
    return index;
 }
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 54fd88a..b238537 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -309,7 +309,7 @@
                = prog->Parameters->Parameters + index;
             char *state = _mesa_program_state_string(param->StateIndexes);
             _mesa_sprintf(str, state);
-            _mesa_free(state);
+            free(state);
          }
          break;
       case PROGRAM_ADDRESS:
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index f5264fa..2c84449 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -957,7 +957,7 @@
 /**
  * Make a string from the given state vector.
  * For example, return "state.matrix.texture[2].inverse".
- * Use _mesa_free() to deallocate the string.
+ * Use free() to deallocate the string.
  */
 char *
 _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c
index a831ce8..c408a84 100644
--- a/src/mesa/shader/prog_uniform.c
+++ b/src/mesa/shader/prog_uniform.c
@@ -45,10 +45,10 @@
 {
    GLuint i;
    for (i = 0; i < list->NumUniforms; i++) {
-      _mesa_free((void *) list->Uniforms[i].Name);
+      free((void *) list->Uniforms[i].Name);
    }
-   _mesa_free(list->Uniforms);
-   _mesa_free(list);
+   free(list->Uniforms);
+   free(list);
 }
 
 
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 0c3c5ff..f4f701b 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -127,11 +127,11 @@
    if (ctx->ATIFragmentShader.Current) {
       ctx->ATIFragmentShader.Current->RefCount--;
       if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
-         _mesa_free(ctx->ATIFragmentShader.Current);
+         free(ctx->ATIFragmentShader.Current);
       }
    }
 #endif
-   _mesa_free((void *) ctx->Program.ErrorString);
+   free((void *) ctx->Program.ErrorString);
 }
 
 
@@ -162,7 +162,7 @@
    if (ctx->ATIFragmentShader.Current) {
       ctx->ATIFragmentShader.Current->RefCount--;
       if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
-         _mesa_free(ctx->ATIFragmentShader.Current);
+         free(ctx->ATIFragmentShader.Current);
       }
    }
    ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
@@ -180,7 +180,7 @@
 _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string)
 {
    ctx->Program.ErrorPos = pos;
-   _mesa_free((void *) ctx->Program.ErrorString);
+   free((void *) ctx->Program.ErrorString);
    if (!string)
       string = "";
    ctx->Program.ErrorString = _mesa_strdup(string);
@@ -190,7 +190,7 @@
 /**
  * Find the line number and column for 'pos' within 'string'.
  * Return a copy of the line which contains 'pos'.  Free the line with
- * _mesa_free().
+ * free().
  * \param string  the program string
  * \param pos     the position within the string
  * \param line    returns the line number corresponding to 'pos'.
@@ -222,7 +222,7 @@
    while (*p != 0 && *p != '\n')
       p++;
    len = p - lineStart;
-   s = (GLubyte *) _mesa_malloc(len + 1);
+   s = (GLubyte *) malloc(len + 1);
    memcpy(s, lineStart, len);
    s[len] = 0;
 
@@ -337,7 +337,7 @@
       return;
 
    if (prog->String)
-      _mesa_free(prog->String);
+      free(prog->String);
 
    _mesa_free_instructions(prog->Instructions, prog->NumInstructions);
 
@@ -351,7 +351,7 @@
       _mesa_free_parameter_list(prog->Attributes);
    }
 
-   _mesa_free(prog);
+   free(prog);
 }
 
 
diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c
index 182ef4c..e5ef25e 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/shader/program_parse.tab.c
@@ -3140,7 +3140,7 @@
 		      ? err_str : "invalid condition code");
 
 	      if (err_str != NULL) {
-		 _mesa_free(err_str);
+		 free(err_str);
 	      }
 
 	      YYERROR;
@@ -3166,7 +3166,7 @@
 		      ? err_str : "invalid condition code");
 
 	      if (err_str != NULL) {
-		 _mesa_free(err_str);
+		 free(err_str);
 	      }
 
 	      YYERROR;
@@ -4547,7 +4547,7 @@
 		      ? err_str : "invalid storage size specifier");
 
 	      if (err_str != NULL) {
-		 _mesa_free(err_str);
+		 free(err_str);
 	      }
 
 	      YYERROR;
@@ -5403,7 +5403,7 @@
    param_list->StateFlags |= _mesa_program_state_flags(tokens);
 
    /* free name string here since we duplicated it in add_parameter() */
-   _mesa_free(name);
+   free(name);
 
    return index;
 }
@@ -5568,7 +5568,7 @@
     */
    length = 1 + vsnprintf(NULL, 0, fmt, args);
 
-   str = _mesa_malloc(length);
+   str = malloc(length);
    if (str) {
       vsnprintf(str, length, fmt, args);
    }
@@ -5588,7 +5588,7 @@
    err_str = make_error_string("glProgramStringARB(%s)\n", s);
    if (err_str) {
       _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
-      _mesa_free(err_str);
+      free(err_str);
    }
 
    err_str = make_error_string("line %u, char %u: error: %s\n",
@@ -5596,7 +5596,7 @@
    _mesa_set_program_error(state->ctx, locp->position, err_str);
 
    if (err_str) {
-      _mesa_free(err_str);
+      free(err_str);
    }
 }
 
@@ -5618,7 +5618,7 @@
 
    /* Make a copy of the program string and force it to be NUL-terminated.
     */
-   strz = (GLubyte *) _mesa_malloc(len + 1);
+   strz = (GLubyte *) malloc(len + 1);
    if (strz == NULL) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
       return GL_FALSE;
@@ -5706,7 +5706,7 @@
 error:
    for (inst = state->inst_head; inst != NULL; inst = temp) {
       temp = inst->next;
-      _mesa_free(inst);
+      free(inst);
    }
 
    state->inst_head = NULL;
@@ -5715,8 +5715,8 @@
    for (sym = state->sym; sym != NULL; sym = temp) {
       temp = sym->next;
 
-      _mesa_free((void *) sym->name);
-      _mesa_free(sym);
+      free((void *) sym->name);
+      free(sym);
    }
    state->sym = NULL;
 
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y
index 577bd2c..299e247 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/shader/program_parse.y
@@ -1056,7 +1056,7 @@
 		      ? err_str : "invalid condition code");
 
 	      if (err_str != NULL) {
-		 _mesa_free(err_str);
+		 free(err_str);
 	      }
 
 	      YYERROR;
@@ -1079,7 +1079,7 @@
 		      ? err_str : "invalid condition code");
 
 	      if (err_str != NULL) {
-		 _mesa_free(err_str);
+		 free(err_str);
 	      }
 
 	      YYERROR;
@@ -1956,7 +1956,7 @@
 		      ? err_str : "invalid storage size specifier");
 
 	      if (err_str != NULL) {
-		 _mesa_free(err_str);
+		 free(err_str);
 	      }
 
 	      YYERROR;
@@ -2442,7 +2442,7 @@
    param_list->StateFlags |= _mesa_program_state_flags(tokens);
 
    /* free name string here since we duplicated it in add_parameter() */
-   _mesa_free(name);
+   free(name);
 
    return index;
 }
@@ -2607,7 +2607,7 @@
     */
    length = 1 + vsnprintf(NULL, 0, fmt, args);
 
-   str = _mesa_malloc(length);
+   str = malloc(length);
    if (str) {
       vsnprintf(str, length, fmt, args);
    }
@@ -2627,7 +2627,7 @@
    err_str = make_error_string("glProgramStringARB(%s)\n", s);
    if (err_str) {
       _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
-      _mesa_free(err_str);
+      free(err_str);
    }
 
    err_str = make_error_string("line %u, char %u: error: %s\n",
@@ -2635,7 +2635,7 @@
    _mesa_set_program_error(state->ctx, locp->position, err_str);
 
    if (err_str) {
-      _mesa_free(err_str);
+      free(err_str);
    }
 }
 
@@ -2657,7 +2657,7 @@
 
    /* Make a copy of the program string and force it to be NUL-terminated.
     */
-   strz = (GLubyte *) _mesa_malloc(len + 1);
+   strz = (GLubyte *) malloc(len + 1);
    if (strz == NULL) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
       return GL_FALSE;
@@ -2745,7 +2745,7 @@
 error:
    for (inst = state->inst_head; inst != NULL; inst = temp) {
       temp = inst->next;
-      _mesa_free(inst);
+      free(inst);
    }
 
    state->inst_head = NULL;
@@ -2754,8 +2754,8 @@
    for (sym = state->sym; sym != NULL; sym = temp) {
       temp = sym->next;
 
-      _mesa_free((void *) sym->name);
-      _mesa_free(sym);
+      free((void *) sym->name);
+      free(sym);
    }
    state->sym = NULL;
 
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 7e2a60f..ad3ff26 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -115,12 +115,12 @@
    shProg->NumShaders = 0;
 
    if (shProg->Shaders) {
-      _mesa_free(shProg->Shaders);
+      free(shProg->Shaders);
       shProg->Shaders = NULL;
    }
 
    if (shProg->InfoLog) {
-      _mesa_free(shProg->InfoLog);
+      free(shProg->InfoLog);
       shProg->InfoLog = NULL;
    }
 }
@@ -134,7 +134,7 @@
 {
    _mesa_free_shader_program_data(ctx, shProg);
 
-   _mesa_free(shProg);
+   free(shProg);
 }
 
 
@@ -262,11 +262,11 @@
 _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh)
 {
    if (sh->Source)
-      _mesa_free((void *) sh->Source);
+      free((void *) sh->Source);
    if (sh->InfoLog)
-      _mesa_free(sh->InfoLog);
+      free(sh->InfoLog);
    _mesa_reference_program(ctx, &sh->Program, NULL);
-   _mesa_free(sh);
+   free(sh);
 }
 
 
@@ -709,7 +709,7 @@
 
          /* alloc new, smaller array */
          newList = (struct gl_shader **)
-            _mesa_malloc((n - 1) * sizeof(struct gl_shader *));
+            malloc((n - 1) * sizeof(struct gl_shader *));
          if (!newList) {
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader");
             return;
@@ -719,7 +719,7 @@
          }
          while (++i < n)
             newList[j++] = shProg->Shaders[i];
-         _mesa_free(shProg->Shaders);
+         free(shProg->Shaders);
 
          shProg->Shaders = newList;
          shProg->NumShaders = n - 1;
@@ -1377,7 +1377,7 @@
       if (c) {
          /* truncate name at [ */
          const GLint len = c - name;
-         GLchar *newName = _mesa_malloc(len + 1);
+         GLchar *newName = malloc(len + 1);
          if (!newName)
             return -1; /* out of mem */
          memcpy(newName, name, len);
@@ -1400,7 +1400,7 @@
             }
          }
 
-         _mesa_free(newName);
+         free(newName);
       }
    }
 
@@ -1431,7 +1431,7 @@
 
    /* free old shader source string and install new one */
    if (sh->Source) {
-      _mesa_free((void *) sh->Source);
+      free((void *) sh->Source);
    }
    sh->Source = source;
    sh->CompileStatus = GL_FALSE;
@@ -2155,7 +2155,7 @@
    if (!shProg->Validated) {
       /* update info log */
       if (shProg->InfoLog) {
-         _mesa_free(shProg->InfoLog);
+         free(shProg->InfoLog);
       }
       shProg->InfoLog = _mesa_strdup(errMsg);
    }
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 2280ceb..6901b93 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -3639,7 +3639,7 @@
    assert(initializer->type == SLANG_OPER_CALL);
    assert(initializer->array_constructor);
 
-   values = (GLfloat *) _mesa_malloc(numElements * 4 * sizeof(GLfloat));
+   values = (GLfloat *) malloc(numElements * 4 * sizeof(GLfloat));
 
    /* convert constructor params into ordinary floats */
    for (i = 0; i < numElements; i++) {
@@ -3670,7 +3670,7 @@
    }
    assert(var->store->Size == size);
 
-   _mesa_free(values);
+   free(values);
 
    return GL_TRUE;
 }
@@ -5321,7 +5321,7 @@
 
    /* free codegen context */
    /*
-   _mesa_free(A->codegen);
+   free(A->codegen);
    */
 
    return success;
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 41d51cd..4280698 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2948,7 +2948,7 @@
 
    /* free shader's prev info log */
    if (shader->InfoLog) {
-      _mesa_free(shader->InfoLog);
+      free(shader->InfoLog);
       shader->InfoLog = NULL;
    }
 
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c
index eab9127..23c08a9 100644
--- a/src/mesa/shader/slang/slang_compile_variable.c
+++ b/src/mesa/shader/slang/slang_compile_variable.c
@@ -182,7 +182,7 @@
    }
 #if 0
    if (var->aux) {
-      _mesa_free(var->aux);
+      free(var->aux);
    }
 #endif
 }
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index b621e89..8bd699f 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -2528,7 +2528,7 @@
    GLuint *subroutineLoc, i, total;
 
    subroutineLoc
-      = (GLuint *) _mesa_malloc(emitInfo->NumSubroutines * sizeof(GLuint));
+      = (GLuint *) malloc(emitInfo->NumSubroutines * sizeof(GLuint));
 
    /* total number of instructions */
    total = mainP->NumInstructions;
@@ -2566,7 +2566,7 @@
 
    /* free subroutine list */
    if (emitInfo->Subroutines) {
-      _mesa_free(emitInfo->Subroutines);
+      free(emitInfo->Subroutines);
       emitInfo->Subroutines = NULL;
    }
    emitInfo->NumSubroutines = 0;
@@ -2585,7 +2585,7 @@
       }
    }
 
-   _mesa_free(subroutineLoc);
+   free(subroutineLoc);
 }
 
 
diff --git a/src/mesa/shader/slang/slang_label.c b/src/mesa/shader/slang/slang_label.c
index 1240621..7e00b57 100644
--- a/src/mesa/shader/slang/slang_label.c
+++ b/src/mesa/shader/slang/slang_label.c
@@ -34,7 +34,7 @@
    if (l) {
       l->Name = (char *) _slang_alloc(strlen(name) + 10);
       if (!l->Name) {
-         _mesa_free(l);
+         free(l);
          return NULL;
       }
       _mesa_sprintf(l->Name, "%s_%d", name, id);
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 68129d4..89658c1 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -68,7 +68,7 @@
 link_error(struct gl_shader_program *shProg, const char *msg)
 {
    if (shProg->InfoLog) {
-      _mesa_free(shProg->InfoLog);
+      free(shProg->InfoLog);
    }
    shProg->InfoLog = _mesa_strdup(msg);
    shProg->LinkStatus = GL_FALSE;
@@ -103,7 +103,7 @@
    GLuint *map, i, firstVarying, newFile;
    GLbitfield *inOutFlags;
 
-   map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint));
+   map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint));
    if (!map)
       return GL_FALSE;
 
@@ -134,7 +134,7 @@
             &shProg->Varying->Parameters[j];
          if (var->Size != v->Size) {
             link_error(shProg, "mismatched varying variable types");
-            _mesa_free(map);
+            free(map);
             return GL_FALSE;
          }
          if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) {
@@ -142,7 +142,7 @@
             _mesa_snprintf(msg, sizeof(msg),
                            "centroid modifier mismatch for '%s'", var->Name);
             link_error(shProg, msg);
-            _mesa_free(map);
+            free(map);
             return GL_FALSE;
          }
          if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) {
@@ -150,7 +150,7 @@
             _mesa_snprintf(msg, sizeof(msg),
                            "invariant modifier mismatch for '%s'", var->Name);
             link_error(shProg, msg);
-            _mesa_free(map);
+            free(map);
             return GL_FALSE;
          }
       }
@@ -162,7 +162,7 @@
 
       if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) {
          link_error(shProg, "Too many varying variables");
-         _mesa_free(map);
+         free(map);
          return GL_FALSE;
       }
 
@@ -202,7 +202,7 @@
       }
    }
 
-   _mesa_free(map);
+   free(map);
 
    /* these will get recomputed before linking is completed */
    prog->InputsRead = 0x0;
@@ -594,7 +594,7 @@
    GLuint totalLen = 0, len = 0;
    GLuint i;
 
-   shaderLengths = (GLuint *)_mesa_malloc(shProg->NumShaders * sizeof(GLuint));
+   shaderLengths = (GLuint *)malloc(shProg->NumShaders * sizeof(GLuint));
    if (!shaderLengths) {
       return NULL;
    }
@@ -611,13 +611,13 @@
    }
 
    if (totalLen == 0) {
-      _mesa_free(shaderLengths);
+      free(shaderLengths);
       return NULL;
    }
 
-   source = (GLchar *) _mesa_malloc(totalLen + 1);
+   source = (GLchar *) malloc(totalLen + 1);
    if (!source) {
-      _mesa_free(shaderLengths);
+      free(shaderLengths);
       return NULL;
    }
 
@@ -634,13 +634,13 @@
    _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source);
    */
 
-   _mesa_free(shaderLengths);
+   free(shaderLengths);
 
    remove_extra_version_directives(source);
 
    newShader = CALLOC_STRUCT(gl_shader);
    if (!newShader) {
-      _mesa_free(source);
+      free(source);
       return NULL;
    }
 
diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/shader/slang/slang_log.c
index 4f6b854..23917fb 100644
--- a/src/mesa/shader/slang/slang_log.c
+++ b/src/mesa/shader/slang/slang_log.c
@@ -43,7 +43,7 @@
 slang_info_log_destruct(slang_info_log * log)
 {
    if (!log->dont_free_text)
-      _mesa_free(log->text);
+      free(log->text);
 }
 
 static int
@@ -63,7 +63,7 @@
 	 _mesa_realloc(log->text, old_len + 1, old_len + size);
    }
    else {
-      log->text = (char *) (_mesa_malloc(size));
+      log->text = (char *) (malloc(size));
       if (log->text != NULL)
          log->text[0] = '\0';
    }
diff --git a/src/mesa/shader/slang/slang_mem.c b/src/mesa/shader/slang/slang_mem.c
index 54f5196..5eaa7c4 100644
--- a/src/mesa/shader/slang/slang_mem.c
+++ b/src/mesa/shader/slang/slang_mem.c
@@ -56,12 +56,12 @@
 slang_mempool *
 _slang_new_mempool(GLuint initialSize)
 {
-   slang_mempool *pool = (slang_mempool *) _mesa_calloc(sizeof(slang_mempool));
+   slang_mempool *pool = (slang_mempool *) calloc(1, sizeof(slang_mempool));
    if (pool) {
-      pool->Data = (char *) _mesa_calloc(initialSize);
+      pool->Data = (char *) calloc(1, initialSize);
       /*printf("ALLOC MEMPOOL %d at %p\n", initialSize, pool->Data);*/
       if (!pool->Data) {
-         _mesa_free(pool);
+         free(pool);
          return NULL;
       }
       pool->Size = initialSize;
@@ -82,8 +82,8 @@
              pool->Used, pool->Size, pool->Count, pool->Largest);
       */
       total += pool->Used;
-      _mesa_free(pool->Data);
-      _mesa_free(pool);
+      free(pool->Data);
+      free(pool);
       pool = next;
    }
    /*printf("TOTAL ALLOCATED: %u\n", total);*/
@@ -125,7 +125,7 @@
 _slang_alloc(GLuint bytes)
 {
 #if USE_MALLOC_FREE
-   return _mesa_calloc(bytes);
+   return calloc(1, bytes);
 #else
    slang_mempool *pool;
    GET_CURRENT_CONTEXT(ctx);
@@ -231,7 +231,7 @@
 _slang_free(void *addr)
 {
 #if USE_MALLOC_FREE
-   _mesa_free(addr);
+   free(addr);
 #else
    if (addr) {
       GET_CURRENT_CONTEXT(ctx);
diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/shader/slang/slang_utility.c
index 56a33e6..dc1e196 100644
--- a/src/mesa/shader/slang/slang_utility.c
+++ b/src/mesa/shader/slang/slang_utility.c
@@ -54,7 +54,7 @@
 slang_string_free (slang_string *self)
 {
    if (self->data != NULL)
-      _mesa_free (self->data);
+      free(self->data);
 }
 
 GLvoid
diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c
index 1f6d9b8..6a5d686 100644
--- a/src/mesa/shader/symbol_table.c
+++ b/src/mesa/shader/symbol_table.c
@@ -354,7 +354,7 @@
 
    for (hdr = table->hdr; hdr != NULL; hdr = next) {
        next = hdr->next;
-       _mesa_free(hdr);
+       free(hdr);
    }
 
    hash_table_dtor(table->ht);
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 1be72e7..33e43dd 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -143,7 +143,7 @@
 						PIPE_TRANSFER_READ, xpos, ypos,
 						width, height);
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
    pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
 
@@ -165,7 +165,7 @@
       _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
    }
 
-   _mesa_free(buf);
+   free(buf);
    screen->tex_transfer_destroy(color_trans);
 }
 
@@ -192,7 +192,7 @@
 						PIPE_TRANSFER_READ, xpos, ypos,
 						width, height);
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
    pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
 
@@ -214,7 +214,7 @@
       _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
    }
 
-   _mesa_free(buf);
+   free(buf);
    screen->tex_transfer_destroy(color_trans);
 }
 
@@ -237,7 +237,7 @@
    if (ST_DEBUG & DEBUG_FALLBACK)
       debug_printf("%s: fallback processing\n", __FUNCTION__);
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
    if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3])
       usage = PIPE_TRANSFER_READ_WRITE;
@@ -282,7 +282,7 @@
 
    pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf);
 
-   _mesa_free(buf);
+   free(buf);
    screen->tex_transfer_destroy(color_trans);
 }
 
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index e029ea7..5968426 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -837,7 +837,7 @@
          screen->tex_transfer_destroy(cache->trans);
       }
       pipe_texture_reference(&st->bitmap.cache->texture, NULL);
-      _mesa_free(st->bitmap.cache);
+      free(st->bitmap.cache);
       st->bitmap.cache = NULL;
    }
 }
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index c92af34..b55a085 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -80,7 +80,7 @@
    if (st_obj->buffer) 
       pipe_buffer_reference(&st_obj->buffer, NULL);
 
-   _mesa_free(st_obj);
+   free(st_obj);
 }
 
 
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 36c0a2b..4e86450 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -828,7 +828,7 @@
    ubyte *buffer;
    int i;
 
-   buffer = _mesa_malloc(width * height * sizeof(ubyte));
+   buffer = malloc(width * height * sizeof(ubyte));
    if (!buffer) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels(stencil)");
       return;
@@ -907,7 +907,7 @@
       }
    }
 
-   _mesa_free(buffer);
+   free(buffer);
 
    /* unmap the stencil buffer */
    screen->transfer_unmap(screen, ptDraw);
@@ -1089,19 +1089,19 @@
 
       if (type == GL_COLOR) {
          /* alternate path using get/put_tile() */
-         GLfloat *buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+         GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
          pipe_get_tile_rgba(ptRead, 0, 0, width, height, buf);
          pipe_put_tile_rgba(ptTex, 0, 0, width, height, buf);
 
-         _mesa_free(buf);
+         free(buf);
       }
       else {
          /* GL_DEPTH */
-         GLuint *buf = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
+         GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
          pipe_get_tile_z(ptRead, 0, 0, width, height, buf);
          pipe_put_tile_z(ptTex, 0, 0, width, height, buf);
-         _mesa_free(buf);
+         free(buf);
       }
 
       screen->tex_transfer_destroy(ptRead);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 4638879..bfa8e21 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -102,14 +102,14 @@
    if(strb->software) {
       size_t size;
       
-      _mesa_free(strb->data);
+      free(strb->data);
 
       assert(strb->format != PIPE_FORMAT_NONE);
       
       strb->stride = util_format_get_stride(strb->format, width);
       size = util_format_get_2d_size(strb->format, strb->stride, height);
       
-      strb->data = _mesa_malloc(size);
+      strb->data = malloc(size);
       
       return strb->data != NULL;
    }
@@ -181,8 +181,8 @@
    ASSERT(strb);
    pipe_surface_reference(&strb->surface, NULL);
    pipe_texture_reference(&strb->texture, NULL);
-   _mesa_free(strb->data);
-   _mesa_free(strb);
+   free(strb->data);
+   free(strb);
 }
 
 
@@ -286,7 +286,7 @@
    default:
       _mesa_problem(NULL,
 		    "Unexpected format in st_new_renderbuffer_fb");
-      _mesa_free(strb);
+      free(strb);
       return NULL;
    }
 
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index dc40c5d..c66729b 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -69,7 +69,7 @@
       stq->pq = NULL;
    }
 
-   _mesa_free(stq);
+   free(stq);
 }
 
 
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 4692891..752b411 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -101,7 +101,7 @@
 static void
 rastpos_destroy(struct draw_stage *stage)
 {
-   _mesa_free(stage);
+   free(stage);
 }
 
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 13f0509..7e50e2a 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1319,7 +1319,7 @@
    else {
       /* RGBA format */
       GLfloat *tempSrc =
-         (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+         (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
       if (tempSrc && texDest) {
          const GLint dims = 2;
@@ -1359,7 +1359,7 @@
       }
 
       if (tempSrc)
-         _mesa_free(tempSrc);
+         free(tempSrc);
    }
 
    st_texture_image_unmap(ctx->st, stImage);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 5b3987d..de8beaf 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -222,7 +222,7 @@
       st->default_texture = NULL;
    }
 
-   _mesa_free( st );
+   free( st );
 }
 
  
@@ -257,7 +257,7 @@
 
    pipe->destroy( pipe );
 
-   _mesa_free(ctx);
+   free(ctx);
 }
 
 
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 50e98d7..13b7b0e 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -239,7 +239,7 @@
 
 
 /** clear-alloc a struct-sized object, with casting */
-#define ST_CALLOC_STRUCT(T)   (struct T *) _mesa_calloc(sizeof(struct T))
+#define ST_CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))
 
 
 extern int
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 537a6a8..807d21a 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -1055,7 +1055,7 @@
 
 
 /**
- * Tokens cannot be free with _mesa_free otherwise the builtin gallium
+ * Tokens cannot be free with free otherwise the builtin gallium
  * malloc debugging will get confused.
  */
 void
diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
index f73ac78..753f313 100644
--- a/src/mesa/swrast/s_blit.c
+++ b/src/mesa/swrast/s_blit.c
@@ -198,14 +198,14 @@
    }
 
    /* allocate the src/dst row buffers */
-   srcBuffer = _mesa_malloc(pixelSize * srcWidth);
+   srcBuffer = malloc(pixelSize * srcWidth);
    if (!srcBuffer) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
-   dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+   dstBuffer = malloc(pixelSize * dstWidth);
    if (!dstBuffer) {
-      _mesa_free(srcBuffer);
+      free(srcBuffer);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
@@ -235,8 +235,8 @@
       drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
    }
 
-   _mesa_free(srcBuffer);
-   _mesa_free(dstBuffer);
+   free(srcBuffer);
+   free(dstBuffer);
 }
 
 
@@ -366,21 +366,21 @@
    /* Allocate the src/dst row buffers.
     * Keep two adjacent src rows around for bilinear sampling.
     */
-   srcBuffer0 = _mesa_malloc(pixelSize * srcWidth);
+   srcBuffer0 = malloc(pixelSize * srcWidth);
    if (!srcBuffer0) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
-   srcBuffer1 = _mesa_malloc(pixelSize * srcWidth);
+   srcBuffer1 = malloc(pixelSize * srcWidth);
    if (!srcBuffer1) {
-      _mesa_free(srcBuffer0);
+      free(srcBuffer0);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
-   dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+   dstBuffer = malloc(pixelSize * dstWidth);
    if (!dstBuffer) {
-      _mesa_free(srcBuffer0);
-      _mesa_free(srcBuffer1);
+      free(srcBuffer0);
+      free(srcBuffer1);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
@@ -444,9 +444,9 @@
       drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
    }
 
-   _mesa_free(srcBuffer0);
-   _mesa_free(srcBuffer1);
-   _mesa_free(dstBuffer);
+   free(srcBuffer0);
+   free(srcBuffer1);
+   free(dstBuffer);
 }
 
 
@@ -535,7 +535,7 @@
    }
 
    /* allocate the row buffer */
-   rowBuffer = _mesa_malloc(bytesPerRow);
+   rowBuffer = malloc(bytesPerRow);
    if (!rowBuffer) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
@@ -548,7 +548,7 @@
       dstY += yStep;
    }
 
-   _mesa_free(rowBuffer);
+   free(rowBuffer);
 }
 
 
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index b69be50..3f37c02 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -114,14 +114,14 @@
    span.arrayAttribs = FRAG_BIT_COL0;
 
    /* allocate space for GLfloat image */
-   tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
    if (!tmpImage) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
       return;
    }
-   convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
    if (!convImage) {
-      _mesa_free(tmpImage);
+      free(tmpImage);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
       return;
    }
@@ -150,7 +150,7 @@
       ASSERT(ctx->Pixel.Separable2DEnabled);
       _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
    }
-   _mesa_free(tmpImage);
+   free(tmpImage);
 
    /* do remaining post-convolution image transfer ops */
    for (row = 0; row < height; row++) {
@@ -185,7 +185,7 @@
       span.array->ChanType = CHAN_TYPE;
    }
 
-   _mesa_free(convImage);
+   free(convImage);
 }
 
 
@@ -246,7 +246,7 @@
    span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
 
    if (overlapping) {
-      tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
+      tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat) * 4);
       if (!tmpImage) {
          _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
          return;
@@ -303,7 +303,7 @@
    span.array->ChanType = CHAN_TYPE; /* restore */
 
    if (overlapping)
-      _mesa_free(tmpImage);
+      free(tmpImage);
 }
 
 
@@ -352,7 +352,7 @@
 
    if (overlapping) {
       GLint ssy = sy;
-      tmpImage = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
+      tmpImage = (GLuint *) malloc(width * height * sizeof(GLuint));
       if (!tmpImage) {
          _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
          return;
@@ -397,7 +397,7 @@
    }
 
    if (overlapping)
-      _mesa_free(tmpImage);
+      free(tmpImage);
 }
 
 
@@ -487,7 +487,7 @@
 
    if (overlapping) {
       GLint ssy = sy;
-      tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat));
+      tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat));
       if (!tmpImage) {
          _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
          return;
@@ -537,7 +537,7 @@
    }
 
    if (overlapping)
-      _mesa_free(tmpImage);
+      free(tmpImage);
 }
 
 
@@ -584,7 +584,7 @@
 
    if (overlapping) {
       GLint ssy = sy;
-      tmpImage = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil));
+      tmpImage = (GLstencil *) malloc(width * height * sizeof(GLstencil));
       if (!tmpImage) {
          _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
          return;
@@ -626,7 +626,7 @@
    }
 
    if (overlapping)
-      _mesa_free(tmpImage);
+      free(tmpImage);
 }
 
 
@@ -688,7 +688,7 @@
 
       if (stencilMask != 0x0) {
          tempStencilImage
-            = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil));
+            = (GLstencil *) malloc(width * height * sizeof(GLstencil));
          if (!tempStencilImage) {
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
             return;
@@ -706,10 +706,10 @@
 
       if (ctx->Depth.Mask) {
          tempDepthImage
-            = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat));
+            = (GLfloat *) malloc(width * height * sizeof(GLfloat));
          if (!tempDepthImage) {
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
-            _mesa_free(tempStencilImage);
+            free(tempStencilImage);
             return;
          }
 
@@ -799,10 +799,10 @@
    }
 
    if (tempStencilImage)
-      _mesa_free(tempStencilImage);
+      free(tempStencilImage);
 
    if (tempDepthImage)
-      _mesa_free(tempDepthImage);
+      free(tempDepthImage);
 }
 
 
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 136c296..7571d5b 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -566,14 +566,14 @@
       GLint row;
       GLfloat *dest, *tmpImage;
 
-      tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+      tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
       if (!tmpImage) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
          return;
       }
-      convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+      convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
       if (!convImage) {
-         _mesa_free(tmpImage);
+         free(tmpImage);
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
          return;
       }
@@ -597,7 +597,7 @@
          ASSERT(ctx->Pixel.Separable2DEnabled);
          _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
       }
-      _mesa_free(tmpImage);
+      free(tmpImage);
 
       /* continue transfer ops and draw the convolved image */
       unpack = &ctx->DefaultPacking;
@@ -677,7 +677,7 @@
    }
 
    if (convImage) {
-      _mesa_free(convImage);
+      free(convImage);
    }
 }
 
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 94fb974..4191133 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -358,14 +358,14 @@
       GLfloat *dest, *src, *tmpImage, *convImage;
       GLint row;
 
-      tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+      tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
       if (!tmpImage) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
          return;
       }
-      convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+      convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
       if (!convImage) {
-         _mesa_free(tmpImage);
+         free(tmpImage);
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
          return;
       }
@@ -399,7 +399,7 @@
          ASSERT(ctx->Pixel.Separable2DEnabled);
          _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
       }
-      _mesa_free(tmpImage);
+      free(tmpImage);
 
       /* finish transfer ops and pack the resulting image */
       src = convImage;
@@ -412,7 +412,7 @@
                                     transferOps & IMAGE_POST_CONVOLUTION_BITS);
          src += width * 4;
       }
-      _mesa_free(convImage);
+      free(convImage);
    }
    else {
       /* no convolution */
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 149f693..8a2787a 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -41,7 +41,7 @@
 static GLubyte *get_space(GLcontext *ctx, GLuint bytes)
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
-   GLubyte *space = _mesa_malloc(bytes);
+   GLubyte *space = malloc(bytes);
    
    tnl->block[tnl->nr_blocks++] = space;
    return space;
@@ -53,7 +53,7 @@
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    GLuint i;
    for (i = 0; i < tnl->nr_blocks; i++)
-      _mesa_free(tnl->block[i]);
+      free(tnl->block[i]);
    tnl->nr_blocks = 0;
 }
 
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index 693d3dc..61ac409 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -152,7 +152,7 @@
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct normal_stage_data *store;
 
-   stage->privatePtr = _mesa_malloc(sizeof(*store));
+   stage->privatePtr = malloc(sizeof(*store));
    store = NORMAL_STAGE_DATA(stage);
    if (!store)
       return GL_FALSE;
@@ -171,7 +171,7 @@
    struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
    if (store) {
       _mesa_vector4f_free( &store->normal );
-      _mesa_free( store );
+      free( store );
       stage->privatePtr = NULL;
    }
 }
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index ab8ea60..20634c8 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -81,7 +81,7 @@
 {
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
    struct point_stage_data *store;
-   stage->privatePtr = _mesa_malloc(sizeof(*store));
+   stage->privatePtr = malloc(sizeof(*store));
    store = POINT_STAGE_DATA(stage);
    if (!store)
       return GL_FALSE;
@@ -97,7 +97,7 @@
    struct point_stage_data *store = POINT_STAGE_DATA(stage);
    if (store) {
       _mesa_vector4f_free( &store->PointSize );
-      _mesa_free( store );
+      free( store );
       stage->privatePtr = NULL;
    }
 }
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index 2b8c962..ed66c35 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -88,7 +88,7 @@
    fastpath->match_strides = match_strides;
    fastpath->func = vtx->emit;
    fastpath->attr = (struct tnl_attr_type *)
-      _mesa_malloc(vtx->attr_count * sizeof(fastpath->attr[0]));
+      malloc(vtx->attr_count * sizeof(fastpath->attr[0]));
 
    for (i = 0; i < vtx->attr_count; i++) {
       fastpath->attr[i].format = vtx->attr[i].format;
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index a284e40..f2f1674 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -854,7 +854,7 @@
       return;
    }
 
-   prim = _mesa_calloc(primcount * sizeof(*prim));
+   prim = calloc(1, primcount * sizeof(*prim));
    if (prim == NULL) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
       return;
@@ -960,7 +960,7 @@
       }
    }
 
-   _mesa_free(prim);
+   free(prim);
 }
 
 
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index 55a82ee..1db36de 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -134,7 +134,7 @@
       /* If we can just tell the hardware or the TNL to interpret our
        * indices with a different base, do so.
        */
-      tmp_prims = (struct _mesa_prim *)_mesa_malloc(sizeof(*prim) * nr_prims);
+      tmp_prims = (struct _mesa_prim *)malloc(sizeof(*prim) * nr_prims);
 
       for (i = 0; i < nr_prims; i++) {
 	 tmp_prims[i] = prim[i];
@@ -187,7 +187,7 @@
    else {
       /* Otherwise the primitives need adjustment.
        */
-      tmp_prims = (struct _mesa_prim *)_mesa_malloc(sizeof(*prim) * nr_prims);
+      tmp_prims = (struct _mesa_prim *)malloc(sizeof(*prim) * nr_prims);
 
       for (i = 0; i < nr_prims; i++) {
 	 /* If this fails, it could indicate an application error:
@@ -229,10 +229,10 @@
 	 max_index - min_index );
    
    if (tmp_indices)
-      _mesa_free(tmp_indices);
+      free(tmp_indices);
    
    if (tmp_prims)
-      _mesa_free(tmp_prims);
+      free(tmp_prims);
 }
 
 
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c
index 2ca1112..2fae267 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/vbo/vbo_split_copy.c
@@ -466,7 +466,7 @@
 
    switch (copy->ib->type) {
    case GL_UNSIGNED_BYTE:
-      copy->translated_elt_buf = _mesa_malloc(sizeof(GLuint) * copy->ib->count);
+      copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
       copy->srcelt = copy->translated_elt_buf;
 
       for (i = 0; i < copy->ib->count; i++)
@@ -474,7 +474,7 @@
       break;
 
    case GL_UNSIGNED_SHORT:
-      copy->translated_elt_buf = _mesa_malloc(sizeof(GLuint) * copy->ib->count);
+      copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
       copy->srcelt = copy->translated_elt_buf;
 
       for (i = 0; i < copy->ib->count; i++)
@@ -500,7 +500,7 @@
     *
     * XXX:  This should be a VBO!
     */
-   copy->dstbuf = _mesa_malloc(copy->dstbuf_size * copy->vertex_size);   
+   copy->dstbuf = malloc(copy->dstbuf_size * copy->vertex_size);   
    copy->dstptr = copy->dstbuf;
 
    /* Setup new vertex arrays to point into the output buffer: 
@@ -529,7 +529,7 @@
 			    copy->ib->count * 2 + 3);
    copy->dstelt_size = MIN2(copy->dstelt_size,
 			    copy->limits->max_indices);
-   copy->dstelt = _mesa_malloc(sizeof(GLuint) * copy->dstelt_size);
+   copy->dstelt = malloc(sizeof(GLuint) * copy->dstelt_size);
    copy->dstelt_nr = 0;
 
    /* Setup the new index buffer to point to the allocated element
@@ -553,9 +553,9 @@
 
    /* Free our vertex and index buffers: 
     */
-   _mesa_free(copy->translated_elt_buf);
-   _mesa_free(copy->dstbuf);
-   _mesa_free(copy->dstelt);
+   free(copy->translated_elt_buf);
+   free(copy->dstbuf);
+   free(copy->dstelt);
 
    /* Unmap VBO's 
     */
diff --git a/src/mesa/vf/vf.c b/src/mesa/vf/vf.c
index 15a78c4..dab436e 100644
--- a/src/mesa/vf/vf.c
+++ b/src/mesa/vf/vf.c
@@ -86,7 +86,7 @@
    fastpath->match_strides = match_strides;
    fastpath->func = vf->emit;
    fastpath->attr = (struct vf_attr_type *)
-      _mesa_malloc(vf->attr_count * sizeof(fastpath->attr[0]));
+      malloc(vf->attr_count * sizeof(fastpath->attr[0]));
 
    for (i = 0; i < vf->attr_count; i++) {
       fastpath->attr[i].format = vf->attr[i].format;