Fixes possible memory leak.