Fixed memory leak in out of memory situation

This commit is contained in:
Tatsuhiro Tsujikawa 2012-04-06 23:36:10 +09:00
parent c89fc13c80
commit 36ba636e30
1 changed files with 2 additions and 1 deletions

View File

@ -811,7 +811,7 @@ static int spdylay_session_get_credential_cert(spdylay_session *session,
return 0;
fail:
for(j = 0; j < i; ++j) {
free(certs[i].data);
free(certs[j].data);
}
free(certs);
return SPDYLAY_ERR_NOMEM;
@ -865,6 +865,7 @@ int spdylay_session_prep_credential(spdylay_session *session,
rv = spdylay_session_add_frame(session, SPDYLAY_CTRL, frame, NULL);
if(rv != 0) {
spdylay_frame_credential_free(&frame->credential);
free(frame);
return rv;
}
return SPDYLAY_ERR_CREDENTIAL_PENDING;