h264_ps: Return meaningful error codes and address a memory leak