Skip to contentSkip to conversation

media: Fix scan-build warnings

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

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v3 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 | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
profiles/audio/media.c +16 -5
index a7fa85d60310..c9328ab9bd6e 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,25 @@ 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;) {
+		struct media_endpoint *endpoint	= l->data;
 
-	while (adapter->players)
-		media_player_destroy(adapter->players->data);
+		l = g_slist_next(l);
+
+		release_endpoint(endpoint);
+	}
+
+	for (l = adapter->players; l;) {
+		struct media_player *mp = l->data;
+
+		l = g_slist_next(l);
+
+		media_player_destroy(mp);
+	}
 
 	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=672985

---Test result---

Test Summary:

CheckPatch                    FAIL      1.14 seconds
GitLint                       PASS      0.81 seconds
Prep - Setup ELL              PASS      26.34 seconds
Build - Prep                  PASS      0.71 seconds
Build - Configure             PASS      8.23 seconds
Build - Make                  PASS      741.51 seconds
Make Check                    PASS      11.09 seconds
Make Check w/Valgrind         PASS      287.49 seconds
Make Distcheck                PASS      237.69 seconds
Build w/ext ELL - Configure   PASS      8.25 seconds
Build w/ext ELL - Make        PASS      82.43 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    PASS      488.18 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,V3] 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/12961483.patch total: 0 errors, 1 warnings, 37 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/12961483.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