summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-sink.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-api-sink.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-api-sink.c')
-rw-r--r--plugins/alsa/alsa-api-sink.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/alsa/alsa-api-sink.c b/plugins/alsa/alsa-api-sink.c
index e38621a..c8f9f9d 100644
--- a/plugins/alsa/alsa-api-sink.c
+++ b/plugins/alsa/alsa-api-sink.c
@@ -55,6 +55,8 @@ PUBLIC AlsaSndPcmT *ApiSinkGetByUid(SoftMixerT *mixer, const char *target) {
PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, json_object * argsJ) {
int index;
+ char *dmixUid = NULL;
+
for (index = 0; index < mixer->max.sinks; index++) {
if (!mixer->sinks[index]) break;
}
@@ -66,7 +68,7 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
switch (json_object_get_type(argsJ)) {
long count;
- char *dmixUid;
+
AlsaPcmCtlT* dmixConfig;
case json_type_object:
@@ -77,7 +79,8 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
// move from hardware to DMIX attach to sndcard
- (void) asprintf(&dmixUid, "dmix-%s", mixer->sinks[index]->uid);
+ if (asprintf(&dmixUid, "dmix-%s", mixer->sinks[index]->uid) == -1)
+ goto OnErrorExit;
dmixConfig = AlsaCreateDmix(mixer, dmixUid, mixer->sinks[index], 0);
if (!dmixConfig) {
@@ -103,7 +106,8 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
// move from hardware to DMIX attach to sndcard
- (void) asprintf(&dmixUid, "dmix-%s", mixer->sinks[index]->uid);
+ if (asprintf(&dmixUid, "dmix-%s", mixer->sinks[index]->uid) == -1)
+ goto OnErrorExit;
dmixConfig = AlsaCreateDmix(mixer, dmixUid, mixer->sinks[index], 0);
if (!dmixConfig) {
@@ -120,5 +124,6 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
return 0;
OnErrorExit:
+ free(dmixUid);
return -1;
-} \ No newline at end of file
+}