Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Oct 1998 12:02:38 -0700 (PDT)
From:      rock@cs.uni-sb.de
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/8212: memory leak in rpc.rstatd
Message-ID:  <199810081902.MAA24876@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         8212
>Category:       bin
>Synopsis:       memory leak in rpc.rstatd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct  8 12:10:01 PDT 1998
>Last-Modified:
>Originator:     Daniel Rock
>Organization:
>Release:        latest current (cvsup)
>Environment:
FreeBSD gate 3.0-BETA FreeBSD 3.0-BETA #45: Wed Oct  7 16:42:18 CEST 1998     root@gate:/usr/src/sys/compile/ROCK  i386
>Description:
rpc.rstatd has a memory leak.
Every few invocations from network it requires an additional
page of memory.

>How-To-Repeat:
Comment out rpc.rstatd in /etc/inetd.conf
Start rpc.rstatd manually: /usr/libexec/rpc.rstatd
Type several times "rup localhost"
Watch memory usage with ps or top

>Fix:
diff -c -r1.12 rstat_proc.c
libdevstat allocates memory during each update. This memory has to be
freed.

*** rstat_proc.c        1998/09/16 21:33:14     1.12
--- rstat_proc.c        1998/10/08 19:01:39
***************
*** 365,370 ****
--- 365,372 ----
                }
        }
  
+       if(stats.dinfo->mem_ptr)
+               free(stats.dinfo->mem_ptr);
        free(stats.dinfo);
        return(retval);
  }
***************
*** 424,429 ****
--- 426,433 ----
                }
        }
  
+       if(stats.dinfo->mem_ptr)
+               free(stats.dinfo->mem_ptr);
        free(stats.dinfo);
  }
  

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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