- // we rely on a reasonable realloc() implementation here - so far I haven't
- // seen any which wouldn't behave like this
+ wxASSERT_MSG( p != NULL, _T("can't free memory?") );
+
+ if ( p != pData )
+ {
+ // contrary to what one might believe, some realloc() implementation do
+ // move the memory block even when its size is reduced
+ pData = (wxStringData *)p;
+
+ m_pchData = pData->data();
+ }