Fixing memory leak and zeroing on alloc.