lib: Fix memory leak (found by Coverity).