Skip to content

Commit

Permalink
ACS CTE: allocateCTEParamsFast() needs to use free() & NOT delete()
Browse files Browse the repository at this point in the history
relates to #135

Requires #147 to be merged into candidate-1.2.0 and then up-merged into
candidate-1.3.0. Without #147 this change will segfault

Signed-off-by: James Noss <[email protected]>
  • Loading branch information
jamienoss committed May 20, 2017
1 parent 5d82a4e commit 5f583fe
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ctegen2/ctehelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,62 +99,63 @@ int allocateCTEParamsFast(CTEParamsFast * pars)

void * tmp = NULL;
tmp = newAndZero((void*)&pars->iz_data, pars->nScaleTableColumns, sizeof(*pars->iz_data));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)&pars->scale512, pars->nScaleTableColumns, sizeof(*pars->scale512));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)&pars->scale1024, pars->nScaleTableColumns, sizeof(*pars->scale1024));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)&pars->scale1536, pars->nScaleTableColumns, sizeof(*pars->scale1536));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)&pars->scale2048, pars->nScaleTableColumns, sizeof(*pars->scale2048));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)&pars->wcol_data, pars->nTraps, sizeof(*pars->wcol_data));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)&pars->qlevq_data, pars->nTraps, sizeof(*pars->qlevq_data));
addPtr(&ptrReg, tmp, &delete);
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
trlerror ("Out of memory.\n");
return OUT_OF_MEMORY;
}
tmp = newAndZero((void*)& pars->dpdew_data, pars->nTraps, sizeof(*pars->dpdew_data));addPtr(&ptrReg, tmp, &delete);
tmp = newAndZero((void*)& pars->dpdew_data, pars->nTraps, sizeof(*pars->dpdew_data));
addPtr(&ptrReg, tmp, &free);
if (!tmp)
{
freeOnExit(&ptrReg);
Expand Down

0 comments on commit 5f583fe

Please sign in to comment.