Fixed a potential memory leak.

(Pointed out by the Clang static analyzer.)