Skip to content

Commit

Permalink
lvtinydom: fix compiler warning [-Wuse-after-free]
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-pierre authored and poire-z committed Jul 29, 2024
1 parent 6d938d2 commit 4f7b6fb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions crengine/src/lvtinydom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2705,12 +2705,9 @@ bool tinyNodeCollection::loadNodeData(lUInt16 type, ldomNode ** list, int nodeco
// buf contains `sz' ldomNode items
// _elemList, _textList (as `list' argument) must always be TNC_PART_LEN size
// add into `list' zero filled (TNC_PART_LEN - sz) items
list[i] = (ldomNode *)realloc(buf, TNC_PART_LEN * sizeof(ldomNode));
if (NULL == list[i]) {
free(buf);
CRLog::error("Not enough memory!");
list[i] = cr_realloc(buf, TNC_PART_LEN);
if (NULL == list[i])
return false;
}
memset( list[i] + sz, 0, (TNC_PART_LEN - sz) * sizeof(ldomNode) );
}
for (int j=0; j<sz; j++) {
Expand Down

0 comments on commit 4f7b6fb

Please sign in to comment.