Fixed compiler warnings.
Fixed memory leak.