Skip to content

Commit 26a8617

Browse files
authored
Merge pull request libgit2#3891 from pks-t/pks/stransport-memory-management-improvements
stransport memory management improvements
2 parents 5961fac + b989514 commit 26a8617

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/stransport_stream.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ int git_stransport_stream_new(git_stream **out, const char *host, const char *po
261261
st->ctx = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);
262262
if (!st->ctx) {
263263
giterr_set(GITERR_NET, "failed to create SSL context");
264+
git__free(st);
264265
return -1;
265266
}
266267

@@ -270,7 +271,8 @@ int git_stransport_stream_new(git_stream **out, const char *host, const char *po
270271
(ret = SSLSetProtocolVersionMin(st->ctx, kTLSProtocol1)) != noErr ||
271272
(ret = SSLSetProtocolVersionMax(st->ctx, kTLSProtocol12)) != noErr ||
272273
(ret = SSLSetPeerDomainName(st->ctx, host, strlen(host))) != noErr) {
273-
git_stream_free((git_stream *)st);
274+
CFRelease(st->ctx);
275+
git__free(st);
274276
return stransport_error(ret);
275277
}
276278

0 commit comments

Comments
 (0)