alsa: Fix double-free issue.

This fixes bug #129.
This commit is contained in:
Uwe Hermann 2013-08-06 21:45:27 +02:00
parent 4d7ddff75b
commit e11a1ebacc
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}
} else {
sr_dbg("No capture handle, no need to close audio device.");
}