[PATCH] fix memory leak dma_declare_coherent_memory()

From: Yoichi Yuasa
Date: Fri Feb 23 2007 - 05:30:17 EST


Hi,

This patch has fixed memory leak in dma_declare_coherent_memory().
When it goes to free1_out, dev->dma_mem has not been freed.

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@xxxxxxxxxxxxxx>

diff -pruN -X generic/Documentation/dontdiff generic-orig/arch/cris/arch-v32/drivers/pci/dma.c generic/arch/cris/arch-v32/drivers/pci/dma.c
--- generic-orig/arch/cris/arch-v32/drivers/pci/dma.c 2007-02-23 19:06:28.355418750 +0900
+++ generic/arch/cris/arch-v32/drivers/pci/dma.c 2007-02-23 19:08:43.311853000 +0900
@@ -111,7 +111,7 @@ int dma_declare_coherent_memory(struct d
return DMA_MEMORY_IO;

free1_out:
- kfree(dev->dma_mem->bitmap);
+ kfree(dev->dma_mem);
out:
return 0;
}
diff -pruN -X generic/Documentation/dontdiff generic-orig/arch/i386/kernel/pci-dma.c generic/arch/i386/kernel/pci-dma.c
--- generic-orig/arch/i386/kernel/pci-dma.c 2007-02-23 19:06:30.183533000 +0900
+++ generic/arch/i386/kernel/pci-dma.c 2007-02-23 19:07:28.475176000 +0900
@@ -110,7 +110,7 @@ int dma_declare_coherent_memory(struct d
return DMA_MEMORY_IO;

free1_out:
- kfree(dev->dma_mem->bitmap);
+ kfree(dev->dma_mem);
out:
if (mem_base)
iounmap(mem_base);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/