You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In large parts of the code base, PoiterVector::pushBack() is being used as pVector.pushBack(new T(...));. With the current pushBack implementation, if the internal call to m_vector.push_back() requires a reallocation and fails, the pointed element is leaked in those cases.
Opening an issue instead of directly addressing it in a PR, because there are a couple possible ways to address it:
Assume ownership is transferred at the pushBack call and clean up the element on error.
Provide a flag cleanupOnError to let the call site determine if the vector should handle the cleanup or the call site.
Assume the call site will handle cleanup of the pointed element on exception and don't do anything in the vector itself.
The text was updated successfully, but these errors were encountered:
In large parts of the code base,
PoiterVector::pushBack()
is being used aspVector.pushBack(new T(...));
. With the currentpushBack
implementation, if the internal call tom_vector.push_back()
requires a reallocation and fails, the pointed element is leaked in those cases.Opening an issue instead of directly addressing it in a PR, because there are a couple possible ways to address it:
pushBack
call and clean up the element on error.cleanupOnError
to let the call site determine if the vector should handle the cleanup or the call site.The text was updated successfully, but these errors were encountered: