1. If you leave Company A your H1B with Company A will be automatically invalid. In most cases, companies withdraw H1B. If you do not join Company B, you may continue with Company A and notify Company B.
2. If you leave Company A, and If you want to go back to Company A; you must get a new H1B Approval from Company A.
You mentioned your H1B with Company B is approved for 1 Year and you also said what if Extension is denied by Company B, please clarify so that I can provide more specific information. Also, please read the following Article for more information on an H1B Visa Transfer.