spa: add spa_aprintf helper

Add a asprintf helper function that handles errors correctly.
Use this in places where we use asprintf to avoid warnings when we
don't check the return value.
This commit is contained in:
Wim Taymans 2020-01-27 12:19:21 +01:00
parent aee3191bad
commit 6ac9b7b3a7
16 changed files with 102 additions and 85 deletions

View file

@ -322,12 +322,12 @@ rd_device_new(DBusConnection *connection, const char *device_name, const char *a
d->application_name = strdup(application_name);
asprintf(&d->object_path, OBJECT_PREFIX "%s", device_name);
d->object_path = spa_aprintf(OBJECT_PREFIX "%s", device_name);
if (d->object_path == NULL) {
res = -errno;
goto error_free;
}
asprintf(&d->service_name, SERVICE_PREFIX "%s", device_name);
d->service_name = spa_aprintf(SERVICE_PREFIX "%s", device_name);
if (d->service_name == NULL) {
res = -errno;
goto error_free;