mesa: rebalance the CALLOC_STRUCT/FREE force.
There were some CALLOC_STRUCT that were using free, rebalance this. Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14325>
This commit is contained in:
parent
3b26dbf8f1
commit
7c79c9bfb1
|
@ -73,7 +73,7 @@ _mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_sha
|
|||
free(s->SetupInst[i]);
|
||||
}
|
||||
_mesa_reference_program(ctx, &s->Program, NULL);
|
||||
free(s);
|
||||
FREE(s);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1490,7 +1490,7 @@ void
|
|||
_mesa_free_attrib_data(struct gl_context *ctx)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(ctx->AttribStack); i++)
|
||||
free(ctx->AttribStack[i]);
|
||||
FREE(ctx->AttribStack[i]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
|
|||
|
||||
if (!n) {
|
||||
free(dlist->Label);
|
||||
free(dlist);
|
||||
FREE(dlist);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ _mesa_destroy_framebuffer(struct gl_framebuffer *fb)
|
|||
if (fb) {
|
||||
_mesa_free_framebuffer_data(fb);
|
||||
free(fb->Label);
|
||||
free(fb);
|
||||
FREE(fb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
|
|||
}
|
||||
|
||||
simple_mtx_destroy(&table->Mutex);
|
||||
free(table);
|
||||
FREE(table);
|
||||
}
|
||||
|
||||
static void init_name_reuse(struct _mesa_HashTable *table)
|
||||
|
|
|
@ -76,7 +76,7 @@ delete_sampler_object(struct gl_context *ctx,
|
|||
{
|
||||
_mesa_delete_sampler_handles(ctx, sampObj);
|
||||
free(sampObj->Label);
|
||||
free(sampObj);
|
||||
FREE(sampObj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -466,7 +466,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
|
|||
simple_mtx_destroy(&shared->Mutex);
|
||||
simple_mtx_destroy(&shared->TexMutex);
|
||||
|
||||
free(shared);
|
||||
FREE(shared);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ _mesa_delete_texture_handles(struct gl_context *ctx,
|
|||
*texHandleObj);
|
||||
}
|
||||
delete_texture_handle(ctx, (*texHandleObj)->handle);
|
||||
free(*texHandleObj);
|
||||
FREE(*texHandleObj);
|
||||
}
|
||||
util_dynarray_fini(&texObj->SamplerHandles);
|
||||
|
||||
|
@ -465,7 +465,7 @@ _mesa_delete_texture_handles(struct gl_context *ctx,
|
|||
util_dynarray_foreach(&texObj->ImageHandles,
|
||||
struct gl_image_handle_object *, imgHandleObj) {
|
||||
delete_image_handle(ctx, (*imgHandleObj)->handle);
|
||||
free(*imgHandleObj);
|
||||
FREE(*imgHandleObj);
|
||||
}
|
||||
util_dynarray_fini(&texObj->ImageHandles);
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ _mesa_delete_sampler_handles(struct gl_context *ctx,
|
|||
*texHandleObj);
|
||||
|
||||
delete_texture_handle(ctx, (*texHandleObj)->handle);
|
||||
free(*texHandleObj);
|
||||
FREE(*texHandleObj);
|
||||
}
|
||||
util_dynarray_fini(&sampObj->Handles);
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ _mesa_delete_transform_feedback_object(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
free(obj->Label);
|
||||
free(obj);
|
||||
FREE(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,7 +92,7 @@ unregister_surface(struct set_entry *entry)
|
|||
}
|
||||
|
||||
_mesa_set_remove(ctx->vdpSurfaces, entry);
|
||||
free(surf);
|
||||
FREE(surf);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
|
|
@ -126,7 +126,7 @@ clear_cache(struct gl_context *ctx, struct gl_program_cache *cache,
|
|||
} else {
|
||||
_mesa_reference_program(ctx, &c->program, NULL);
|
||||
}
|
||||
free(c);
|
||||
FREE(c);
|
||||
}
|
||||
cache->items[i] = NULL;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ _mesa_new_program_cache(void)
|
|||
cache->items =
|
||||
calloc(cache->size, sizeof(struct cache_item *));
|
||||
if (!cache->items) {
|
||||
free(cache);
|
||||
FREE(cache);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ _mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cach
|
|||
{
|
||||
clear_cache(ctx, cache, GL_FALSE);
|
||||
free(cache->items);
|
||||
free(cache);
|
||||
FREE(cache);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -168,7 +168,7 @@ _mesa_delete_shader_cache(struct gl_context *ctx,
|
|||
{
|
||||
clear_cache(ctx, cache, GL_TRUE);
|
||||
free(cache->items);
|
||||
free(cache);
|
||||
FREE(cache);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
|
|||
}
|
||||
free(paramList->Parameters);
|
||||
align_free(paramList->ParameterValues);
|
||||
free(paramList);
|
||||
FREE(paramList);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ void st_delete_sync_object(struct gl_context *ctx,
|
|||
screen->fence_reference(screen, &so->fence, NULL);
|
||||
simple_mtx_destroy(&so->mutex);
|
||||
free(so->b.Label);
|
||||
free(so);
|
||||
FREE(so);
|
||||
}
|
||||
|
||||
void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
|
||||
|
|
|
@ -502,7 +502,7 @@ st_framebuffer_create(struct st_context *st,
|
|||
/* add the color buffer */
|
||||
idx = stfb->Base._ColorDrawBufferIndexes[0];
|
||||
if (!st_framebuffer_add_renderbuffer(stfb, idx, prefer_srgb)) {
|
||||
free(stfb);
|
||||
FREE(stfb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -862,7 +862,7 @@ st_manager_destroy(struct st_manager *smapi)
|
|||
if (smPriv && smPriv->stfbi_ht) {
|
||||
_mesa_hash_table_destroy(smPriv->stfbi_ht, NULL);
|
||||
simple_mtx_destroy(&smPriv->st_mutex);
|
||||
free(smPriv);
|
||||
FREE(smPriv);
|
||||
smapi->st_manager_private = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ delete_variant(struct st_context *st, struct st_variant *v, GLenum target)
|
|||
}
|
||||
}
|
||||
|
||||
free(v);
|
||||
FREE(v);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -911,7 +911,7 @@ st_create_common_variant(struct st_context *st,
|
|||
}
|
||||
default:
|
||||
assert(!"unhandled shader type");
|
||||
free(v);
|
||||
FREE(v);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "main/arrayobj.h"
|
||||
#include "main/bufferobj.h"
|
||||
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "vbo_private.h"
|
||||
|
||||
|
||||
|
@ -61,12 +63,12 @@ void vbo_save_destroy( struct gl_context *ctx )
|
|||
|
||||
if (save->prim_store) {
|
||||
free(save->prim_store->prims);
|
||||
free(save->prim_store);
|
||||
FREE(save->prim_store);
|
||||
save->prim_store = NULL;
|
||||
}
|
||||
if (save->vertex_store) {
|
||||
free(save->vertex_store->buffer_in_ram);
|
||||
free(save->vertex_store);
|
||||
FREE(save->vertex_store);
|
||||
save->vertex_store = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue