PVS V506: using pointer to deallocated stack space

Change-Id: I43f7d0208f7d644d6f4274a9a718773f7a1346a0
Reviewed-on: https://review.haiku-os.org/c/1600
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
This commit is contained in:
Adrien Destugues 2019-07-16 18:09:47 +02:00 committed by Stephan Aßmus
parent 11cba1646d
commit 1ec8732c71

View File

@ -5676,9 +5676,12 @@ void
BTextView::_ApplyStyleRange(int32 fromOffset, int32 toOffset, uint32 mode,
const BFont* font, const rgb_color* color, bool syncNullStyle)
{
BFont normalized;
// Declared before the if so it stays allocated until the call to
// SetStyleRange
if (font != NULL) {
// if a font has been given, normalize it
BFont normalized = *font;
normalized = *font;
_NormalizeFont(&normalized);
font = &normalized;
}