Skip to content

Commit

Permalink
ALSA: PCM: Fix possible memory leaks in the error path
Browse files Browse the repository at this point in the history
When the first page allocation failed for sgbuf, it leaks the records
that have been formerly allocated.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Aug 3, 2012
1 parent ac190c7 commit c810f90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/core/sgbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void *snd_malloc_sgbuf_pages(struct device *device,
if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, device,
chunk, &tmpb) < 0) {
if (!sgbuf->pages)
return NULL;
goto _failed;
if (!res_size)
goto _failed;
size = sgbuf->pages * PAGE_SIZE;
Expand Down

0 comments on commit c810f90

Please sign in to comment.