NOT_ENOUGH_MEMORY from ramsurf after bad malloc

Return NOT_ENOUGH_MEMORY from ramsurf in case a malloc or a realloc
fails during the compuratoin.