summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-09-26 11:08:11 -0700
committerIan Romanick <[email protected]>2012-09-28 15:06:58 -0700
commit5174eed79343346e7e39cf47d1cb18e6caa76c54 (patch)
tree7c5ccc694c2b167e0ca16057a6d04f3b4b9e364b /src/mesa
parent8c1c18769ef4838b11065b353f6f62bfd1de1cd2 (diff)
dri_util: Use calloc to allocate __DRIcontext
The __DRIcontext contains some pointers, and some drivers check for them to be NULL in some failure paths. Instead of sprinkling NULL assignments across the various drivers, just zero out the whole thing. NOTE: This is a candidate for the 9.0 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-and-tested-by: Kenneth Graunke <[email protected]> Tested-by: Lu Hua <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301 (cherry picked from commit f93cb0bebb10e3e3e5df099be51021b211650356)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 4276ad981f9..983bbea49da 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -272,7 +272,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
return NULL;
}
- context = malloc(sizeof *context);
+ context = calloc(1, sizeof *context);
if (!context) {
*error = __DRI_CTX_ERROR_NO_MEMORY;
return NULL;