X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Falsa%2Fapi.c;h=9bb2ce251ff29e3ce2116aa9c5f1983317b52710;hb=21d464a7e53efc9ac9810d9301a12b6a56fdb061;hp=dd5588dd4ff11c10d92e5ec6c96eb7f7db0bbad0;hpb=3b412e3a305cf06ac9bbb91ca5025d1712617b71;p=libsigrok.git diff --git a/hardware/alsa/api.c b/hardware/alsa/api.c index dd5588dd..9bb2ce25 100644 --- a/hardware/alsa/api.c +++ b/hardware/alsa/api.c @@ -43,7 +43,10 @@ static void clear_helper(void *priv) devc = priv; snd_pcm_hw_params_free(devc->hw_params); + devc->hw_params = NULL; + g_free((void *)devc->samplerates); + devc->samplerates = NULL; } static int dev_clear(void) @@ -108,12 +111,11 @@ static int dev_close(struct sr_dev_inst *sdi) if (devc->capture_handle) { sr_dbg("Closing PCM device."); - if ((ret = snd_pcm_close(devc->capture_handle)) < 0) { + if ((ret = snd_pcm_close(devc->capture_handle)) < 0) sr_err("Failed to close device: %s.", snd_strerror(ret)); - devc->capture_handle = NULL; - sdi->status = SR_ST_INACTIVE; - } + devc->capture_handle = NULL; + sdi->status = SR_ST_INACTIVE; } else { sr_dbg("No capture handle, no need to close audio device."); }