From f7e04866ccb32095e0ff55762a631d30ac182e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lowas-Rzechonek?= Date: Tue, 30 Apr 2019 12:30:00 +0200 Subject: [PATCH] a2dp: Fixed warn_unused_result warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This used to break builds when using maintainer mode via ./bootstrap-configure: profiles/audio/a2dp.c:1775:2: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result] asprintf(&sep->path, "%s/sep%d", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- profiles/audio/a2dp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index 4d378a91a..d0676b577 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -1821,8 +1821,15 @@ static void register_remote_sep(void *data, void *user_data) if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL)) goto done; - asprintf(&sep->path, "%s/sep%d", device_get_path(chan->device), - avdtp_get_seid(rsep)); + if (asprintf(&sep->path, "%s/sep%d", + device_get_path(chan->device), + avdtp_get_seid(rsep)) < 0) { + error("Could not allocate path for remote sep %s/sep%d", + device_get_path(chan->device), + avdtp_get_seid(rsep)); + sep->path = NULL; + goto done; + } if (g_dbus_register_interface(btd_get_dbus_connection(), sep->path, MEDIA_ENDPOINT_INTERFACE, -- 2.47.3