We were using REALLOC() from u_memory.h but FREE() from imports.h.
This mismatch caused us to trash the heap on Windows after we
deleted a texture object.
This fixes a regression from commit
6c59be7776e4d.
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
pipe_resource_reference(&stObj->pt, NULL);
st_texture_release_all_sampler_views(stObj);
- FREE(stObj->sampler_views);
+ st_texture_free_sampler_views(stObj);
_mesa_delete_texture_object(ctx, texObj);
}
for (i = 0; i < stObj->num_sampler_views; ++i)
pipe_sampler_view_reference(&stObj->sampler_views[i], NULL);
}
+
+
+void
+st_texture_free_sampler_views(struct st_texture_object *stObj)
+{
+ /* NOTE:
+ * We use FREE() here to match REALLOC() above. Both come from
+ * u_memory.h, not imports.h. If we mis-match MALLOC/FREE from
+ * those two headers we can trash the heap.
+ */
+ FREE(stObj->sampler_views);
+}
extern void
st_texture_release_all_sampler_views(struct st_texture_object *stObj);
+void
+st_texture_free_sampler_views(struct st_texture_object *stObj);
+
#endif