- if (c->pkeys[i].x509 != NULL)
- X509_free(c->pkeys[i].x509);
- c->pkeys[i].x509=x;
- c->key= &(c->pkeys[i]);
-
- if ((s->session != NULL) && (s->session->peer != NULL))
+ if (sc->peer_pkeys[i].x509 != NULL) /* Why would this ever happen?
+ * We just created sc a couple of
+ * lines ago. */
+ X509_free(sc->peer_pkeys[i].x509);
+ sc->peer_pkeys[i].x509=x;
+ sc->peer_key= &(sc->peer_pkeys[i]);
+
+ if (s->session->peer != NULL)