The returned pointer must be allocated on the heap as wxGridCellDateTimeRenderer::GetString() currently deletes it. This seems like a rather poor idea, as any internally stored values must be cloned on each call, but it seems too dangerous to change this as it could result in massive memory leaks in the existing code.