Fixing the possible memory leak.