I cannot stress this enough, the offer you made on the house should have a contingency clause that will cancel the deal if the house does not pass a complete home inspection.
This is not an automatic deal killer. Sometimes a buyer can make a deal with the seller to either fix the problem or pay the buyer money to fix the problem. If the buyer and seller agree to this, then the sale continues. In cases where the inspection uncovers something so big that the buyer wants to cancel the offer, the home inspection contingency clause allows the buyer to do this without loss of earnest money.