[CHECKER] bugs in FreeBSD
Ruslan Ermilov
ru at FreeBSD.org
Sun Jan 18 04:44:25 PST 2004
Scott,
Attached is the patch that fixes memory leak according to the below report.
On Fri, Jan 16, 2004 at 04:09:34PM -0800, Paul Twohey wrote:
> ---------------------------------------------------------
> [BUG] though we should demote things that are not locals.
> /u2/engler/mc/freebsd/sys/i386/compile/GENERIC/../../../dev/ips/ips.c:148:ips_add_waiting_command:ERROR:LEAK:148:154: pointer=waiter from RO=malloc(-1) [s=550,pop=551,pr=1.00] [rank=med] leaked! [z=1.0] [success=5]
>
> ips_command_t *command;
> ips_wait_list_t *waiter;
> unsigned long memflags = 0;
> if(IPS_NOWAIT_FLAG & flags)
> memflags = M_NOWAIT;
> Start --->
> waiter = malloc(sizeof(ips_wait_list_t), M_DEVBUF, memflags);
> if(!waiter)
> return ENOMEM;
> mask = splbio();
> if(sc->state & IPS_OFFLINE){
> splx(mask);
> Error --->
> return EIO;
> }
> command = SLIST_FIRST(&sc->free_cmd_list);
> if(command && !(sc->state & IPS_TIMEOUT)){
> ---------------------------------------------------------
Cheers,
--
Ruslan Ermilov
FreeBSD committer
ru at FreeBSD.org
-------------- next part --------------
Index: ips.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ips/ips.c,v
retrieving revision 1.6
diff -u -p -r1.6 ips.c
--- ips.c 27 Nov 2003 08:37:36 -0000 1.6
+++ ips.c 18 Jan 2004 12:41:22 -0000
@@ -163,14 +163,14 @@ static int ips_add_waiting_command(ips_s
unsigned long memflags = 0;
if(IPS_NOWAIT_FLAG & flags)
memflags = M_NOWAIT;
- waiter = malloc(sizeof(ips_wait_list_t), M_DEVBUF, memflags);
- if(!waiter)
- return ENOMEM;
mask = splbio();
if(sc->state & IPS_OFFLINE){
splx(mask);
return EIO;
}
+ waiter = malloc(sizeof(ips_wait_list_t), M_DEVBUF, memflags);
+ if(!waiter)
+ return ENOMEM;
command = SLIST_FIRST(&sc->free_cmd_list);
if(command && !(sc->state & IPS_TIMEOUT)){
SLIST_REMOVE_HEAD(&sc->free_cmd_list, next);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040118/0975715a/attachment.bin
More information about the freebsd-hackers
mailing list