PUGH tries to free memory not allocated by malloc

Issue #2764 new
Roland Haas created an issue

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.

Comments (0)

  1. Log in to comment