Adam Tla/lka <atlka@pg.gda.pl>

SHM memory leak fix
This commit is contained in:
Jaroslav Kysela 2004-01-20 12:47:05 +00:00
parent 6c3f250896
commit 852b0c6129

View file

@ -462,11 +462,16 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
if (i->u.shm.area) { if (i->u.shm.area) {
snd_shm_area_destroy(i->u.shm.area); snd_shm_area_destroy(i->u.shm.area);
i->u.shm.area = NULL; i->u.shm.area = NULL;
} else { if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
err = shmdt(i->addr); pcm->access == SND_PCM_ACCESS_RW_INTERLEAVED) {
if (err < 0) { unsigned int c1;
SYSERR("shmdt failed"); for (c1 = c + 1; c1 < pcm->channels; c1++) {
return -errno; snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
if (i1->u.shm.area) {
snd_shm_area_destroy(i1->u.shm.area);
i1->u.shm.area = NULL;
}
}
} }
} }
break; break;