소스 검색

ALSA: PCM: Fix possible memory leaks in the error path

When the first page allocation failed for sgbuf, it leaks the records
that have been formerly allocated.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 13 년 전
부모
커밋
c810f9039f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      sound/core/sgbuf.c

+ 1 - 1
sound/core/sgbuf.c

@@ -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;