8261601: free memory in early return in Java_sun_nio_ch_sctp_SctpChannelImpl_receive0

Reviewed-by: clanger, dfuchs, bpb
This commit is contained in:
Matthias Baesken 2021-02-16 08:40:14 +00:00
parent e2d52ae265
commit cdc874d4c9

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -475,6 +475,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
iov->iov_len = SCTP_NOTIFICATION_SIZE - rv;
if ((rv = recvmsg(fd, msg, flags)) < 0) {
handleSocketError(env, errno);
free(newBuf);
return 0;
}
bufp = newBuf;