All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] obexd: Fix FILE* leak in phonebook-dummy
@ 2026-09-30  7:39 Jinwang Li
  2026-09-30 15:08 ` [v1] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Jinwang Li @ 2026-09-30  7:39 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: cheng.jiang, quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
	jinwang.li, xiuzhuo.shang

fdopen(fd, "r") transfers ownership of fd to the FILE stream, but the
loop was calling close(fd) directly instead of fclose(fp), leaking the
FILE structure and its stdio buffer on every vCard read. Also handle
fdopen() failure, which was previously unchecked.

Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
---
 obexd/plugins/phonebook-dummy.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index f308ea701..43be956a5 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -164,6 +164,13 @@ static int foreach_vcard(DIR *dp, vcard_func_t func, uint16_t offset,
 		}
 
 		fp = fdopen(fd, "r");
+		if (fp == NULL) {
+			err = errno;
+			error("fdopen(%s): %s(%d)", filename, strerror(err), err);
+			close(fd);
+			continue;
+		}
+
 		v = Parse_MIME_FromFile(fp);
 		if (v != NULL) {
 			func(filename, v, user_data);
@@ -171,7 +178,7 @@ static int foreach_vcard(DIR *dp, vcard_func_t func, uint16_t offset,
 			n++;
 		}
 
-		close(fd);
+		fclose(fp);
 	}
 
 	g_slist_free_full(sorted, g_free);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [v1] obexd: Fix FILE* leak in phonebook-dummy
  2026-09-30  7:39 [PATCH v1] obexd: Fix FILE* leak in phonebook-dummy Jinwang Li
@ 2026-09-30 15:08 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-09-30 15:08 UTC (permalink / raw)
  To: linux-bluetooth, jinwang.li

[-- Attachment #1: Type: text/plain, Size: 1806 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1176647/

---Test result---

Test Summary:
CheckPatch                    FAIL      0.36 seconds
GitLint                       PASS      0.22 seconds
BuildEll                      PASS      19.90 seconds
BluezMake                     PASS      386.30 seconds
CheckSmatch                   PASS      295.83 seconds
bluezmakeextell               PASS      95.06 seconds
TestFunctional                PASS      1128.28 seconds
IncrementalBuild              PASS      403.49 seconds
ScanBuild                     PASS      1123.46 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v1] obexd: Fix FILE* leak in phonebook-dummy
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#129: FILE: obexd/plugins/phonebook-dummy.c:169:
+			error("fdopen(%s): %s(%d)", filename, strerror(err), err);

/home/runner/work/bluez/bluez/src/patch/14857371.patch total: 0 errors, 1 warnings, 21 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/home/runner/work/bluez/bluez/src/patch/14857371.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




https://github.com/bluez/bluez/pull/2611

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-30 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-30  7:39 [PATCH v1] obexd: Fix FILE* leak in phonebook-dummy Jinwang Li
2026-09-30 15:08 ` [v1] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.