A
Andreas Eibach
Hi again,
one of the other big woes I'm having...
typedef struct perBlockStru /* (structure) Long words per block
*/
{
unsigned long *lword[LASTLW];
} lwperBlockStru_t;
typedef struct Entity /* (structure) Holds the whole thing */
{
perBlockStru_t* block[LASTBLK];
} entityStru_t;
This is a - fairly simplified - structure I'm using.
Of course there are more elements, but they are irrelevant here.
Far below, there's the obvious mem allocation happening:
(pE = *entityStru_t)
for (i 0; i = LASTBLK; i++)
{ ...
for (j= 0; j = LASTLW; j++)
{ ...
pE->block->lword[j] = malloc (sizeof(unsigned long));
...
}
}
At the VERY bottom, shortly before exiting the app, I *thought* I could just
do:
if (pE != NULL)
free(pE);
Preposterously, it sometimes does work, but sometimes I also get a GPF.
Hence I assume that I am required to go the "awkward" way by using another
loop
in the destruction routine.
Or is this supposed to work by simply using the free routine from the
structure's base address?
-Andreas
one of the other big woes I'm having...
typedef struct perBlockStru /* (structure) Long words per block
*/
{
unsigned long *lword[LASTLW];
} lwperBlockStru_t;
typedef struct Entity /* (structure) Holds the whole thing */
{
perBlockStru_t* block[LASTBLK];
} entityStru_t;
This is a - fairly simplified - structure I'm using.
Of course there are more elements, but they are irrelevant here.
Far below, there's the obvious mem allocation happening:
(pE = *entityStru_t)
for (i 0; i = LASTBLK; i++)
{ ...
for (j= 0; j = LASTLW; j++)
{ ...
pE->block->lword[j] = malloc (sizeof(unsigned long));
...
}
}
At the VERY bottom, shortly before exiting the app, I *thought* I could just
do:
if (pE != NULL)
free(pE);
Preposterously, it sometimes does work, but sometimes I also get a GPF.
Hence I assume that I am required to go the "awkward" way by using another
loop
in the destruction routine.
Or is this supposed to work by simply using the free routine from the
structure's base address?
-Andreas