On 30 August 2018 at 14:52, Brian Paul <bri...@vmware.com> wrote: > 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.veli...@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. > Thanks Brian.
Had a quick look - dri2.c includes u_memory.h, while dri_screen.c uses imports.h, transitively via utils.h (the one in dri/common). The last header will always pull imports.h one way or another. Simplest solution is to (re)move CALLOC_STRUCT from imports.h - where, how, etc will end up more time consuming that what I have atm :-\ Anyone willing to sort that, please go ahead; personally I'd worry when it becomes an obvious issue. HTH Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev