fix coverity-found resource leaks on error paths.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>