From dfb3cb20af735cbc55fe928ac80cf089052a4244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 10 Jun 2023 02:22:08 +0200 Subject: [PATCH] pipewire: module-raop-sink: check asprintf return value GCC warns because `asprintf()` has the `warn_unused_result` attribute, so check the return value to silence the warning. --- src/modules/module-raop-sink.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/module-raop-sink.c b/src/modules/module-raop-sink.c index 332002985..871fad096 100644 --- a/src/modules/module-raop-sink.c +++ b/src/modules/module-raop-sink.c @@ -1226,7 +1226,7 @@ static int rtsp_do_announce(struct impl *impl) switch (impl->encryption) { case CRYPTO_NONE: - asprintf(&sdp, "v=0\r\n" + sdp = spa_aprintf("v=0\r\n" "o=iTunes %s 0 IN IP%d %s\r\n" "s=iTunes\r\n" "c=IN IP%d %s\r\n" @@ -1236,10 +1236,12 @@ static int rtsp_do_announce(struct impl *impl) "a=fmtp:96 %d 0 16 40 10 14 2 255 0 0 %u\r\n", impl->session_id, ip_version, local_ip, ip_version, host, frames, impl->info.rate); + if (!sdp) + return -errno; break; case CRYPTO_AUTH_SETUP: - asprintf(&sdp, "v=0\r\n" + sdp = spa_aprintf("v=0\r\n" "o=iTunes %s 0 IN IP%d %s\r\n" "s=iTunes\r\n" "c=IN IP%d %s\r\n" @@ -1251,6 +1253,8 @@ static int rtsp_do_announce(struct impl *impl) impl->session_id, ip_version, local_ip, ip_version, host, frames, impl->info.rate, impl->latency + RAOP_LATENCY_MIN); + if (!sdp) + return -errno; break; case CRYPTO_RSA: @@ -1265,7 +1269,7 @@ static int rtsp_do_announce(struct impl *impl) base64_encode(rsakey, rsa_len, key, '='); base64_encode(impl->iv, 16, iv, '='); - asprintf(&sdp, "v=0\r\n" + sdp = spa_aprintf("v=0\r\n" "o=iTunes %s 0 IN IP%d %s\r\n" "s=iTunes\r\n" "c=IN IP%d %s\r\n" @@ -1278,6 +1282,8 @@ static int rtsp_do_announce(struct impl *impl) impl->session_id, ip_version, local_ip, ip_version, host, frames, impl->info.rate, key, iv); + if (!sdp) + return -errno; break; default: return -ENOTSUP;