facedetector: Fix memory management issues

Change-Id: Ic5e2e33a46e6ed13299afc3a3b0c49869f715361