Fixed memory leak

Fixed memory leak.