I understand perfectly well. I was merely pointing two facts:
1. If malloc/realloc fails, it is not enough to ignore the fact that
buffer == NULL. The indexing process has to be aborted in some way.
Meaning, your added if statement should have an else clause, probably
with an exception thrown
Hi,
you don't understand... If buffer == NULL, then
_tcsncpy(buffer,_term->text(), bufferLength); - at this point we have
potential bug
Need
[code]
//Instantiate the new buffer + 1 is needed for terminator '\0'
if ( buffer == NULL )
buffer = (TCHAR*)malloc(sizeof(TC
Hi,
If malloc / realloc returns NULL the indexing process has to be aborted
anyway, and the only way I can think of doing this is throwing an
exception. Did you have other idea in mind?
Also, I'm not sure why growBuffer is used there at all. This is a simple
TCHAR array being used as a buf
Hi,
src/core/CLucene/index/SegmentTermEnum.cpp : line 377
[code]
//Instantiate the new buffer + 1 is needed for terminator '\0'
if ( buffer == NULL )
buffer = (TCHAR*)malloc(sizeof(TCHAR) * (bufferLength+1));
else
buffer = (TCHAR*)realloc(buffer, si