diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2003-04-01 16:17:03 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2003-04-01 16:17:03 +0000 |
commit | e9f4ee87d84eefd3dadc3801fc4027f6b28204e6 (patch) | |
tree | 8ef6dedde807e0ec0e5124b17fac45b5797da94b /src/mesa/main | |
parent | 8412c604518893d66b78bf78ffda2c02f861d5a9 (diff) |
_mesa_realloc() fix
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/nvfragparse.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/main/nvfragparse.c b/src/mesa/main/nvfragparse.c index ff546db612..75f4e84db3 100644 --- a/src/mesa/main/nvfragparse.c +++ b/src/mesa/main/nvfragparse.c @@ -1,4 +1,4 @@ -/* $Id: nvfragparse.c,v 1.15 2003/03/19 05:34:25 brianp Exp $ */ +/* $Id: nvfragparse.c,v 1.16 2003/04/01 16:17:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -42,16 +42,16 @@ #include "nvprogram.h" -/* XXX move */ +/* XXX move into imports.[ch] eventually */ static void * _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) { + size_t copySize = MIN2(oldSize, newSize); void *newBuffer = _mesa_malloc(newSize); - size_t bytes = MIN2(oldSize, newSize); - if (newBuffer && bytes > 0) { - _mesa_memcpy(newBuffer, oldBuffer, bytes); - } - _mesa_free(oldBuffer); + if (newBuffer && copySize > 0) + _mesa_memcpy(newBuffer, oldBuffer, copySize); + if (oldBuffer) + _mesa_free(oldBuffer); return newBuffer; } |