[Mesa-stable] [Mesa-dev] [PATCH] st/dri: use the FREE wrapper for the dri screen
Brian Paul
brianp at vmware.com
Thu Aug 30 13:52:15 UTC 2018
On 08/30/2018 07:32 AM, Eric Engestrom wrote:
> On Thursday, 2018-08-30 11:12:11 +0100, Emil Velikov wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> The memory is allocated with the uppercase wrapper. Tear down should
>> match that.
>
> You're right, in dri2_init_screen() / dri_kms_init_screen(), but looking
> at the history this used to be FREE() and Brian replaced a bunch of them
> with free() in fe72a069d1fcce943f315 "mesa: s/FREE/free/".
>
> Cc'ing him to check if going back is the right thing, or if maybe instead
> it's the CALLOC() in dri2.c that should be replaced with calloc()?
Unfortunately, there's two different definitions of CALLOC_STRUCT:
src/gallium/auxiliary/util/u_memory.h:58:#define CALLOC_STRUCT(T)
(struct T *) CALLOC(1, sizeof(struct T))
src/mesa/main/imports.h:58:#define CALLOC_STRUCT(T) (struct T *)
calloc(1, sizeof(struct T))
(by amazing coincidence they're on the same line number!)
The former calls CALLOC() which wraps os_calloc() while the later calls
calloc().
You just have to be sure to use free/FREE which matches the underlying
CALLOC(). After only a quick look it's not obvious to me which is
correct here but I'm sure you can figure it out.
-Brian
>
>>
>> Cc: mesa-stable at lists.freedesktop.org
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>
>> ---
>> src/gallium/state_trackers/dri/dri_screen.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
>> index 3e4de59a433..98b02678c81 100644
>> --- a/src/gallium/state_trackers/dri/dri_screen.c
>> +++ b/src/gallium/state_trackers/dri/dri_screen.c
>> @@ -484,7 +484,7 @@ dri_destroy_screen(__DRIscreen * sPriv)
>>
>> pipe_loader_release(&screen->dev, 1);
>>
>> - free(screen);
>> + FREE(screen);
>> sPriv->driverPrivate = NULL;
>> sPriv->extensions = NULL;
>> }
>> --
>> 2.18.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fmesa-dev&data=02%7C01%7Cbrianp%40vmware.com%7Cb3cdaba097544ad60e3d08d60e7d0603%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636712327476193623&sdata=PvdH0sHKaHCn8XfN8ToksT3dXgs6KUknYAUcHTnIQzo%3D&reserved=0
More information about the mesa-stable
mailing list