mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-22 21:48:09 +02:00
radeon,r200: use align_calloc for the context to fix m32 crashes
Fixes:3175b63a0d"mesa: don't allocate matrices with malloc" Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9220> (cherry picked from commit81cf4bef7e)
This commit is contained in:
parent
00c346d277
commit
79b1d162a1
4 changed files with 9 additions and 6 deletions
|
|
@ -769,7 +769,7 @@
|
|||
"description": "radeon,r200: use align_calloc for the context to fix m32 crashes",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "3175b63a0dfa290430f9f7eb651387788933a02b"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include "utils.h"
|
||||
#include "util/driconf.h" /* for symbolic values of enum-type options */
|
||||
#include "util/u_memory.h"
|
||||
|
||||
/* Return various strings for glGetString().
|
||||
*/
|
||||
|
|
@ -200,7 +201,7 @@ GLboolean r200CreateContext( gl_api api,
|
|||
assert(screen);
|
||||
|
||||
/* Allocate the R200 context */
|
||||
rmesa = calloc(1, sizeof(*rmesa));
|
||||
rmesa = align_calloc(sizeof(*rmesa), 16);
|
||||
if ( !rmesa ) {
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return GL_FALSE;
|
||||
|
|
@ -238,7 +239,7 @@ GLboolean r200CreateContext( gl_api api,
|
|||
if (!radeonInitContext(&rmesa->radeon, api, &functions,
|
||||
glVisual, driContextPriv,
|
||||
sharedContextPrivate)) {
|
||||
free(rmesa);
|
||||
align_free(rmesa);
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
#include "tnl/tnl.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#ifndef RADEON_DEBUG
|
||||
int RADEON_DEBUG = (0);
|
||||
|
|
@ -286,7 +287,7 @@ void radeonDestroyContext(__DRIcontext *driContextPriv )
|
|||
fclose(track);
|
||||
}
|
||||
#endif
|
||||
free(radeon);
|
||||
align_free(radeon);
|
||||
}
|
||||
|
||||
/* Force the context `c' to be unbound from its buffer.
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include "utils.h"
|
||||
#include "util/driconf.h" /* for symbolic values of enum-type options */
|
||||
#include "util/u_memory.h"
|
||||
|
||||
extern const struct tnl_pipeline_stage _radeon_render_stage;
|
||||
extern const struct tnl_pipeline_stage _radeon_tcl_stage;
|
||||
|
|
@ -165,7 +166,7 @@ r100CreateContext( gl_api api,
|
|||
assert(screen);
|
||||
|
||||
/* Allocate the Radeon context */
|
||||
rmesa = calloc(1, sizeof(*rmesa));
|
||||
rmesa = align_calloc(sizeof(*rmesa), 16);
|
||||
if ( !rmesa ) {
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return GL_FALSE;
|
||||
|
|
@ -200,7 +201,7 @@ r100CreateContext( gl_api api,
|
|||
if (!radeonInitContext(&rmesa->radeon, api, &functions,
|
||||
glVisual, driContextPriv,
|
||||
sharedContextPrivate)) {
|
||||
free(rmesa);
|
||||
align_free(rmesa);
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue