aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-06-14 05:12:59 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-06-26 02:11:34 +0200
commitbbc27e4c2e60113ad172ae8384d2da0891558115 (patch)
tree921c2db37fe69d0f51894f864b175fd091bca404 /samsung-ipc
parent6944793cd6a99673b0fd1f0785f1201ae90c97cb (diff)
downloadhardware_replicant_libsamsung-ipc-bbc27e4c2e60113ad172ae8384d2da0891558115.tar.gz
hardware_replicant_libsamsung-ipc-bbc27e4c2e60113ad172ae8384d2da0891558115.tar.bz2
hardware_replicant_libsamsung-ipc-bbc27e4c2e60113ad172ae8384d2da0891558115.zip
aries_gprs_get_iface: handle asprintf errors
Without that fix we have the following warning: ../../../samsung-ipc/devices/aries/aries.c: In function 'aries_gprs_get_iface': ../../../samsung-ipc/devices/aries/aries.c:826:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result] 826 | asprintf(&iface, "%s%d", ARIES_GPRS_IFACE_PREFIX, cid - 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'samsung-ipc')
-rw-r--r--samsung-ipc/devices/aries/aries.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c
index 93d5d31..9fc905a 100644
--- a/samsung-ipc/devices/aries/aries.c
+++ b/samsung-ipc/devices/aries/aries.c
@@ -819,11 +819,16 @@ char *aries_gprs_get_iface(__attribute__((unused)) struct ipc_client *client,
unsigned int cid)
{
char *iface = NULL;
+ int rc;
if (cid > ARIES_GPRS_IFACE_COUNT)
return NULL;
- asprintf(&iface, "%s%d", ARIES_GPRS_IFACE_PREFIX, cid - 1);
+ rc = asprintf(&iface, "%s%d", ARIES_GPRS_IFACE_PREFIX, cid - 1);
+ if (rc == -1) {
+ ipc_client_log(client, "%s: asprintf failed", __func__);
+ return NULL;
+ }
return iface;
}