Add alocation function, allocation error

there is a fail in alocation function