Fixed #3145 (False negative: no memory leak warning - return value of realloc(NULL,) ignored)