From cc3dd149f811ada9eb70a4641af9ebfd06e0b427 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 27 May 2014 12:15:11 +0300 Subject: [PATCH] shared/crypto: Fix fd leaks in bt_crypto_sign_att() --- src/shared/crypto.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/shared/crypto.c b/src/shared/crypto.c index b8eb00650..e46f07fd1 100644 --- a/src/shared/crypto.c +++ b/src/shared/crypto.c @@ -284,12 +284,18 @@ bool bt_crypto_sign_att(struct bt_crypto *crypto, const uint8_t key[16], return false; len = send(fd, msg, msg_len, 0); - if (len < 0) + if (len < 0) { + close(fd); return false; + } len = read(fd, out, 16); - if (len < 0) + if (len < 0) { + close(fd); return false; + } + + close(fd); /* * As to BT spec. 4.1 Vol[3], Part C, chapter 10.4.1 sign counter should -- 2.47.3