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@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Lu Hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
This commit is contained in:
Ian Romanick 2012-09-26 11:08:11 -07:00
parent 4c704e5949
commit f93cb0bebb

View file

@ -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;