Re: Possible memory leak
Joe Nosay <[email protected]> Fri, 14 Oct 2016 15:23:04 -0400
| Newsgroups | gmane.os.openbsd.sparc |
|---|---|
| Message-ID | <CA+WntOuE5Nu=Vkp0TRn15E1awAO_L+THntWFohBR4GFu-c9Y6Q@mail.gmail.com> |
Have you tried the manual page http://man.openbsd.org/bus_dma.9 ? On Thu, Oct 13, 2016 at 12:39 AM, <[email protected]> wrote: > On Wed, Oct 12, 2016 at 04:26:20PM -0400, Joe Nosay wrote: > > Where in the code is the problem? > > > > On Tue, Oct 11, 2016 at 11:49 PM, <[email protected]> wrote: > > > > 836 vd = malloc(sizeof(struct vdsk_dring), M_DEVBUF, M_NOWAIT); > 837 if (vd == NULL) > 838 return NULL; > 839 > > assuming this suceeds... > > 840 size = roundup(nentries * sizeof(struct vd_desc), PAGE_SIZE); > 841 > 842 if (bus_dmamap_create(t, size, 1, size, 0, > 843 BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &vd->vd_map) != 0) > 844 return (NULL); > > but this fails. > > Now we return NULL, due to failure. but there's no reference to vd > which will allow us to free it later. > > (I may be misunderstanding what bus_dmamap_create does, but probably not. >