#2764: PUGH tries to free memory not allocated by malloc
Reporter: Roland Haas
Status: new
Milestone:
Version:
Type: bug
Priority: major
Component:
Compiling PUGH I get warnings:
```
In function ‘PUGH_SetupPGExtrasMemory’,
inlined from ‘PUGH_SetupPGExtras’ at /data/rhaas/postdoc/gr/cactus/ET_trunk/configs/sim/build/PUGH/SetupPGV.c:101:11:
/data/rhaas/postdoc/gr/cactus/ET_trunk/configs/sim/build/PUGH/SetupPGV.c:648:9: warning: ‘free’ called on pointer ‘this’ with nonzero offset 136 [-Wfree-nonheap-object]
648 | free(this->overlap);
| ^~~~~~~~~~~~~~~~~~~
/data/rhaas/postdoc/gr/cactus/ET_trunk/configs/sim/build/PUGH/SetupPGV.c: In function ‘PUGH_SetupPGExtras’:
/data/rhaas/postdoc/gr/cactus/ET_trunk/configs/sim/build/PUGH/SetupPGV.c:96:10: note: returned from ‘malloc’
96 | this = malloc(sizeof(pGExtras));
|
```
which are correct since `overlap` is not actually from `malloc` \(and neither are `ownvership` and `ghosts`\).
The whole erro handling in `SetupPGV.c` is broken though, it e.g. assumes that `malloc` returns memory that is `NULL` initialized.
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2764/pugh-tries-to-fre…