Fix memory leaks in the Certificate extensions code