[ET Trac] #2764: PUGH tries to free memory not allocated by malloc
Roland Haas
trac-noreply at einsteintoolkit.org
Mon Nov 20 09:15:27 CST 2023
#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-free-memory-not-allocated-by
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/trac/attachments/20231120/e8799763/attachment-0001.htm>
More information about the Trac
mailing list