Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Nov 2009 17:56:50 +0800
From:      "beezarliu" <beezarliu@yahoo.com.cn>
To:        "freebsd-net" <freebsd-net@freebsd.org>
Subject:   possible memory leak in em_dma_free?
Message-ID:  <200911251756446718122@yahoo.com.cn>

next in thread | raw e-mail | index | archive | help
Hi all, 

I saw em driver, and found a possible memory leak.
dma->dma_map may be NULL, so the dma memory will not be freed.
I think the condition will it be beter if  it is "(dma->dma_vaddr != NULL) {"

Thanks

static void
em_dma_free(struct adapter *adapter, struct em_dma_alloc *dma)
{
 if (dma->dma_tag == NULL)
  return;
 if (dma->dma_map != NULL) {             --> if (dma->dma_vaddr != NULL) {
      bus_dmamap_sync(dma->dma_tag, dma->dma_map,
      BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
  bus_dmamap_unload(dma->dma_tag, dma->dma_map);
  bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
  dma->dma_map = NULL;
 }
 bus_dma_tag_destroy(dma->dma_tag);
 dma->dma_tag = NULL;
}

2009-11-25 



beezarliu 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911251756446718122>