Fixed delete[] call over a non array object
Fixed memory leak