summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-plug-route.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-06-11 16:21:00 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-06-11 16:21:00 +0200
commitb53304b2ff507801aeb19aa38291f328458e57e9 (patch)
tree212ab0dee1b171a26b36cd10873360f6983c09bd /plugins/alsa/alsa-plug-route.c
parentaf967e17050d813aaf209a4c6197775d3b92bcfb (diff)
Fixed compilation warning with _FORTIFY_SOURCE=2
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-plug-route.c')
-rw-r--r--plugins/alsa/alsa-plug-route.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c
index 306ddeb..a225983 100644
--- a/plugins/alsa/alsa-plug-route.c
+++ b/plugins/alsa/alsa-plug-route.c
@@ -70,14 +70,17 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
int scount=0, error = 0;
ChannelCardPortT slave, channel;
AlsaPcmCtlT *pcmRoute = calloc(1, sizeof (AlsaPcmCtlT));
+ char *cardid = NULL;
+ char *dmixUid = NULL;
if (!mixer->sinks) {
AFB_ApiError(mixer->api, "AlsaCreateRoute: mixer=%s zone(%s)(zone) No sink found [should Registry sound card first]", mixer->uid, zone->uid);
goto OnErrorExit;
}
- char *cardid;
- (void) asprintf(&cardid, "route-%s", zone->uid);
+ if (asprintf(&cardid, "route-%s", zone->uid) == -1)
+ goto OnErrorExit;
+
pcmRoute->cid.cardid = (const char *) cardid;
pcmRoute->params = ApiSinkGetParamsByZone(mixer, zone->uid);
@@ -91,8 +94,8 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
}
// move from hardware to DMIX attach to sndcard
- char *dmixUid;
- (void) asprintf(&dmixUid, "dmix-%s", slave.uid);
+ if (asprintf(&dmixUid, "dmix-%s", slave.uid) == -1)
+ goto OnErrorExit;
// temporary store to unable multiple channel to route to the same port
snd_config_t **cports = alloca(slave.ccount * sizeof (void*));
@@ -177,6 +180,8 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
OnErrorExit:
free(pcmRoute);
+ free(cardid);
+ free(dmixUid);
AlsaDumpCtlConfig(mixer, "plug-pcm", snd_config, 1);
AlsaDumpCtlConfig(mixer, "plug-route", routeConfig, 1);
AFB_ApiNotice(mixer->api, "AlsaCreateRoute:zone(%s) OnErrorExit\n", zone->uid);