Fix memory leak when joining arrays containing null