Add sizes for free() in clct(4)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Add sizes for free() in clct(4)

Frederic Cambus
Hi tech@,

Here is a diff to add sizes for free() in clct(4).

Similar diff to the ones previously sent for other audio drivers.

Comments? OK?

Index: sys/dev/pci/cs4281.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cs4281.c,v
retrieving revision 1.36
diff -u -p -r1.36 cs4281.c
--- sys/dev/pci/cs4281.c 19 Sep 2016 06:46:44 -0000 1.36
+++ sys/dev/pci/cs4281.c 20 Dec 2019 15:56:40 -0000
@@ -1187,7 +1187,7 @@ cs4281_malloc(void *addr, int direction,
  error = cs4281_allocmem(sc, size, pool, flags, p);
 
  if (error) {
- free(p, pool, 0);
+ free(p, pool, sizeof(*p));
  return (0);
  }
 
@@ -1212,7 +1212,7 @@ cs4281_free(void *addr, void *ptr, int p
  bus_dmamem_unmap(sc->sc_dmatag, p->addr, p->size);
  bus_dmamem_free(sc->sc_dmatag, p->segs, p->nsegs);
  *pp = p->next;
- free(p, pool, 0);
+ free(p, pool, sizeof(*p));
  return;
  }
  }

Reply | Threaded
Open this post in threaded view
|

Re: Add sizes for free() in clct(4)

Jan Klemkow
On Fri, Dec 20, 2019 at 05:26:56PM +0100, Frederic Cambus wrote:
> Here is a diff to add sizes for free() in clct(4).
>
> Similar diff to the ones previously sent for other audio drivers.
>
> Comments? OK?

OK jan@
 

> Index: sys/dev/pci/cs4281.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/cs4281.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 cs4281.c
> --- sys/dev/pci/cs4281.c 19 Sep 2016 06:46:44 -0000 1.36
> +++ sys/dev/pci/cs4281.c 20 Dec 2019 15:56:40 -0000
> @@ -1187,7 +1187,7 @@ cs4281_malloc(void *addr, int direction,
>   error = cs4281_allocmem(sc, size, pool, flags, p);
>  
>   if (error) {
> - free(p, pool, 0);
> + free(p, pool, sizeof(*p));
>   return (0);
>   }
>  
> @@ -1212,7 +1212,7 @@ cs4281_free(void *addr, void *ptr, int p
>   bus_dmamem_unmap(sc->sc_dmatag, p->addr, p->size);
>   bus_dmamem_free(sc->sc_dmatag, p->segs, p->nsegs);
>   *pp = p->next;
> - free(p, pool, 0);
> + free(p, pool, sizeof(*p));
>   return;
>   }
>   }
>