Mesa (master): dri_util: Use calloc to allocate __DRIcontext
Ian Romanick
idr at kemper.freedesktop.org
Fri Sep 28 22:05:43 UTC 2012
Module: Mesa
Branch: master
Commit: f93cb0bebb10e3e3e5df099be51021b211650356
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f93cb0bebb10e3e3e5df099be51021b211650356
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Wed Sep 26 11:08:11 2012 -0700
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 <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth at whitecape.org>
Tested-by: Lu Hua <huax.lu at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
---
src/mesa/drivers/dri/common/dri_util.c | 2 +-
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 4276ad9..983bbea 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;
More information about the mesa-commit
mailing list