Fix several possible memory leaks in the GPE handling.

This change fixes several potential memory leaks in the error paths
of the GPE handling code. Lv Zheng.