diff options
author | Stephane Desneux <stephane.desneux@iot.bzh> | 2018-12-22 11:51:54 +0100 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@iot.bzh> | 2018-12-22 11:51:54 +0100 |
commit | c85fd2f131c73e8c21e05e1ea80b55d6a787dda6 (patch) | |
tree | 248aca4a75556e3546a3c89cac43bcffe3ccf634 /plugins/alsa/alsa-plug-route.c | |
parent | e0f57e523112e1bc73a04e8615d7a21355f0ce0e (diff) |
Implemented the bug cleanup at application exit
Fixes most memory leaks in softmixer.
The concept of 'transaction' for dynamic streams has
been generalized to the objects created at startup.
The cleanup is done via a handle set through a atexit()
call.
Also added a missing strdup in alsa-api-loop, that fixes
a double free.
Warning, the bluez-alsa PCM are not closed in this
version. This is intentional due to a BUG in the
bluealsa ioplug PCM, that crashes upon close
(pthread_cancel is used to terminate the io_thread
and things get very bad. I have a pending fix for
that, relying on a cancellation pipe, but deeper
testing must be done).
As an effect, only one phone call can be made,
else 4a needs to be restarted
Change-Id: Idb84cafe15f17c0ef02fcc70296d541dc55a2dcf
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-plug-route.c')
-rw-r--r-- | plugins/alsa/alsa-plug-route.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c index c00c0cf..ebc7074 100644 --- a/plugins/alsa/alsa-plug-route.c +++ b/plugins/alsa/alsa-plug-route.c @@ -113,7 +113,17 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o goto fail_nodump; } - zone->params = pcmRoute->params; + pcmRoute->params = ApiPcmParamsDup(mixer, pcmRoute->params); + if (!pcmRoute->params) { + SOFTMIXER_NOMEM(mixer->api); + goto fail_nodump; + } + + zone->params = ApiPcmParamsDup(mixer, pcmRoute->params); + if (!zone->params) { + SOFTMIXER_NOMEM(mixer->api); + goto fail_nodump; + } // use 1st zone channel to retrieve sound card name + channel count. |