[PATCH lksctp-tools 2/5] fix memory leak in test_peer_addr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Qiumiao Zhang <zhangqiumiao1@xxxxxxxxxx>
---
 src/testlib/sctputil.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/testlib/sctputil.c b/src/testlib/sctputil.c
index 780c7b3..97a04f0 100644
--- a/src/testlib/sctputil.c
+++ b/src/testlib/sctputil.c
@@ -374,6 +374,7 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
 	error = sctp_getpaddrs(sk, asoc, &addrs);
 	if (-1 == error) {
 		tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s", strerror(errno));
+		free(found);
 		return error;
 	}
 	if (error != count) {
@@ -396,6 +397,7 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int cou
 		default:
 			errno = EINVAL;
 			sctp_freepaddrs(addrs);
+			free(found);
 			tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s", strerror(errno));
 			return -1;
 		}
--
2.27.0




[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     SCTP

  Powered by Linux