busted loop condition and coverity#1255390 Resource leak

regression from

commit 119873328acd70ca3569c21a0b1fe36277e8bf4c
Date:   Thu Oct 21 15:34:02 2010 -0500
    convert vos/process.hxx and related API

Change-Id: I36527a4f0109105b9853a79773b4c92f9bc4e902
(cherry picked from commit ecc56da366960b642d0a7da1b4a47245243252f8)
Reviewed-on: https://gerrit.libreoffice.org/13016
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>