summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-plug-vol.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-vol.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-vol.c')
-rw-r--r--plugins/alsa/alsa-plug-vol.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/alsa/alsa-plug-vol.c b/plugins/alsa/alsa-plug-vol.c
index 968ae73..54f3c6d 100644
--- a/plugins/alsa/alsa-plug-vol.c
+++ b/plugins/alsa/alsa-plug-vol.c
@@ -27,8 +27,10 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
AlsaPcmCtlT *pcmVol= calloc(1,sizeof(AlsaPcmCtlT));
int error = 0;
- char *cardid;
- (void) asprintf(&cardid, "softvol-%s", stream->uid);
+ char *cardid = NULL;
+ if (asprintf(&cardid, "softvol-%s", stream->uid) == -1)
+ goto OnErrorExit;
+
pcmVol->cid.cardid = (const char *) cardid;
// refresh global alsalib config and create PCM top config
@@ -80,6 +82,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
return pcmVol;
OnErrorExit:
+ free(cardid);
//AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);
AlsaDumpCtlConfig(mixer, "plug-softvol", streamConfig, 1);
AFB_ApiNotice(mixer->api, "AlsaCreateSoftvol:%s(stream) OnErrorExit\n", stream->uid);