Skip to content

Commit 4549774

Browse files
committed
Fixed compile warning delete[]
1 parent 4b3fe6e commit 4549774

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wsjcpp_obj_tree.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,15 @@ bool WsjcppObjTreeNodeString::readDataPartFromFile(std::ifstream &f, std::string
457457
}
458458
nStringLen = *reinterpret_cast<uint32_t*>(arrInteger);
459459
char *pStr = new char[nStringLen];
460+
460461
f.read(pStr, nStringLen);
461462
if (!f) {
462-
delete pStr;
463+
delete[] pStr;
463464
sError = "WsjcppObjTreeNodeString. Could not read string data. File broken. Can read " + std::to_string(f.gcount());
464465
return false;
465466
}
466467
m_sValue = std::string(pStr, nStringLen);
468+
delete[] pStr;
467469
return true;
468470
}
469471

0 commit comments

Comments
 (0)