C++: Initialize memory after allocating symbol pointers

Change-Id: Ife1d3f963ef6781f96031f41ae3858b2c278145e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-08-03 22:11:28 +03:00
committed by Orgad Shaneh
parent 5abfef609a
commit ba9787a009

View File

@@ -117,6 +117,7 @@ void SymbolTable::enterSymbol(Symbol *symbol)
_allocatedSymbols = DefaultInitialSize;
_symbols = reinterpret_cast<Symbol **>(realloc(_symbols, sizeof(Symbol *) * _allocatedSymbols));
memset(_symbols + _symbolCount, 0, sizeof(Symbol *) * (_allocatedSymbols - _symbolCount));
}
symbol->_index = _symbolCount;