Fix leak in setting certificate chain patch

Android has a custom certificate chain patch that didn't check whether
the cert_chain was already set when setting the new chain. This results
in a leak of all the X509 instances in the stack of certificates.

(cherry picked from commit bb8428f762b3632f493572c4f73957e1281ade79)

Bug: 10610037
Bug: http://code.google.com/p/android/issues/detail?id=59536
Change-Id: I885a5dd0d0bca9d1003c4e4e7f0e500bead2232f
Merge "Fix leak in setting certificate chain patch"
Merge https://android.googlesource.com/platform/external/openssl into HEAD