This paper considers the throughput maximization of a secondary user (SU) in a realistic cognitive radio (CR) network where the battery suffers from constant energy leakage. We investigate two different CR scenarios where the primary user (PU) switches between idle and active states in a time-slotted manner. In the first scenario, the SU knows the exact state of the PU at the beginning of each time slot, whereas in the second scenario, the SU attempts to detect state of the PU by spectrum sensing. For both scenarios, we determine the maximum throughput of the SU with consideration of battery leakage of the SU and interference constraint of the PU. The optimal solutions of transmitting power and sensing duration are achieved by using golden section search method and a simplified brute-force search method. Finally, the theoretical analysis is verified through the Monte Carlo simulations.