diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-06-14 05:12:59 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-06-26 02:11:34 +0200 |
commit | 6944793cd6a99673b0fd1f0785f1201ae90c97cb (patch) | |
tree | b5686234fe28a376798dd86a175e895dac79065d | |
parent | 4412cad28a7619330f83974a15d512e5c37e8eb5 (diff) | |
download | hardware_replicant_libsamsung-ipc-6944793cd6a99673b0fd1f0785f1201ae90c97cb.tar.gz hardware_replicant_libsamsung-ipc-6944793cd6a99673b0fd1f0785f1201ae90c97cb.tar.bz2 hardware_replicant_libsamsung-ipc-6944793cd6a99673b0fd1f0785f1201ae90c97cb.zip |
crespo_gprs_get_iface: handle asprintf errors
Without that fix we have the following warning:
../../../samsung-ipc/devices/crespo/crespo.c:
In function 'crespo_gprs_get_iface':
../../../samsung-ipc/devices/crespo/crespo.c:587:9: warning:
ignoring return value of 'asprintf' declared with attribute
'warn_unused_result' [-Wunused-result]
587 | asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, cid - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | samsung-ipc/devices/crespo/crespo.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c index 27e1dd5..5399e77 100644 --- a/samsung-ipc/devices/crespo/crespo.c +++ b/samsung-ipc/devices/crespo/crespo.c @@ -584,11 +584,16 @@ char *crespo_gprs_get_iface(__attribute__((unused)) struct ipc_client *client, unsigned int cid) { char *iface = NULL; + int rc; if (cid > CRESPO_GPRS_IFACE_COUNT) return NULL; - asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, cid - 1); + rc = asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, cid - 1); + if (rc == -1) { + ipc_client_log(client, "%s: asprintf failed", __func__); + return NULL; + } return iface; } |