From b53304b2ff507801aeb19aa38291f328458e57e9 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Mon, 11 Jun 2018 16:21:00 +0200 Subject: Fixed compilation warning with _FORTIFY_SOURCE=2 Signed-off-by: Thierry Bultel --- plugins/alsa/alsa-plug-vol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/alsa/alsa-plug-vol.c') 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); -- cgit 1.2.3-korg