Mesa (master): mesa: fix a valgrind warning

Marek Olšák mareko at kemper.freedesktop.org
Sat Sep 10 13:15:13 UTC 2011


Module: Mesa
Branch: master
Commit: 2a5cbc5306686a5ad210317843bd0dc7950b6ce9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a5cbc5306686a5ad210317843bd0dc7950b6ce9

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat Sep 10 15:12:54 2011 +0200

mesa: fix a valgrind warning

==5715== Invalid read of size 4
==5715==    at 0x4AA590B: _mesa_make_extension_string (extensions.c:908)
==5715==    by 0x4A83198: _mesa_make_current (context.c:1514)
==5715==    by 0x4A71CAB: st_api_make_current (st_manager.c:789)
==5715==  Address 0x4795730 is 0 bytes inside a block of size 1 alloc'd
==5715==    at 0x4025315: calloc (vg_replace_malloc.c:467)
==5715==    by 0x4AA5B4C: _mesa_make_extension_string (extensions.c:772)
==5715==    by 0x4A83198: _mesa_make_current (context.c:1514)
==5715==    by 0x4A71CAB: st_api_make_current (st_manager.c:789)

---

 src/mesa/main/extensions.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 1903a50..aceddaa 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -769,7 +769,7 @@ get_extension_override( struct gl_context *ctx )
    if (env_const == NULL) {
       /* Return the empty string rather than NULL. This simplifies the logic
        * of client functions. */
-      return calloc(1, sizeof(char));
+      return calloc(4, sizeof(char));
    }
 
    /* extra_exts: List of unrecognized extensions. */




More information about the mesa-commit mailing list