Skip to contentSkip to conversation

media: Fix scan-build warnings

PATCH Superseded Luiz Augusto von Dentz 2 participants 2 messages Aug 31, 2022 Bluetooth drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/1 media: Fix scan-build warnings

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following warnings:

profiles/audio/media.c:1465:6: warning: 8th function call argument is an uninitialized value
if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3012:3: warning: Use of memory after it is freed

                release_endpoint(adapter->endpoints->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3015:3: warning: Use of memory after it is freed
                media_player_destroy(adapter->players->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 profiles/audio/media.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
profiles/audio/media.c +6 -5
index a7fa85d60310..49d8fc2f5e53 100644
@@ -1440,7 +1440,7 @@ static DBusMessage *register_endpoint(DBusConnection *conn, DBusMessage *msg,
 	gboolean delay_reporting = FALSE;
 	uint8_t codec = 0;
 	struct bt_bap_pac_qos qos = {};
-	uint8_t *capabilities;
+	uint8_t *capabilities = NULL;
 	int size = 0;
 	int err;
 
@@ -3005,14 +3005,15 @@ static const GDBusPropertyTable media_properties[] = {
 static void path_free(void *data)
 {
 	struct media_adapter *adapter = data;
+	GSList *l;
 
 	queue_destroy(adapter->apps, app_free);
 
-	while (adapter->endpoints)
-		release_endpoint(adapter->endpoints->data);
+	for (l = adapter->endpoints; l; l = g_slist_next(l))
+		release_endpoint(l->data);
 
-	while (adapter->players)
-		media_player_destroy(adapter->players->data);
+	for (l = adapter->players; l; l = g_slist_next(l))
+		media_player_destroy(l->data);
 
 	adapters = g_slist_remove(adapters, adapter);
 
Signature · 1 line
2.37.2
#1 lore raw

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/project/bluetooth/list/?series=672640

---Test result---

Test Summary:

CheckPatch                    FAIL      1.20 seconds
GitLint                       PASS      0.78 seconds
Prep - Setup ELL              PASS      34.95 seconds
Build - Prep                  PASS      0.99 seconds
Build - Configure             PASS      10.72 seconds
Build - Make                  PASS      1120.71 seconds
Make Check                    PASS      12.41 seconds
Make Check w/Valgrind         PASS      347.72 seconds
Make Distcheck                PASS      298.51 seconds
Build w/ext ELL - Configure   PASS      10.12 seconds
Build w/ext ELL - Make        PASS      102.54 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    PASS      655.75 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,V2] media: Fix scan-build warnings
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #85:
if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,

/github/workspace/src/12960169.patch total: 0 errors, 1 warnings, 27 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.

/github/workspace/src/12960169.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.

---
Regards,
Linux Bluetooth