Fix for warning: 'res' may be used uninitialized in this function