[BusyBox] udhcpc memory leak on lease renewal
Russ Dill
Russ.Dill at asu.edu
Wed May 19 04:47:25 UTC 2004
On Tue, 2004-05-18 at 10:03, Stephane Billiart wrote:
> There is a memory leak in udhcpc: on my system that has been running
> for 6 days, I can see the process size is almost 5MB.
>
> # ps auxwww|grep udhcpc
> 13589 root 5008 S udhcpc -i eth0 -p /var/run/udhcpc.pid -s /etc/udhcpc.
>
> If I force lease renewals, the size increases further
>
> # killall -USR1 udhcpc; ps auxwww|grep udhcpc
> 13589 root 5020 S udhcpc -i eth0 -p /var/run/udhcpc.pid -s /etc/udhcpc.
> 21612 root 252 S grep udhcpc
> # killall -USR1 udhcpc; ps auxwww|grep udhcpc
> 13589 root 5040 S udhcpc -i eth0 -p /var/run/udhcpc.pid -s /etc/udhcpc.
> 13268 root 252 S grep udhcpc
>
> This is busybox v1.00-pre10, built 2004.05.11 from CVS with uclibc 0.9.26.
Index: script.c
===================================================================
RCS file: /var/cvs/udhcp/script.c,v
retrieving revision 1.19
diff -u -r1.19 script.c
--- a/script.c 24 Dec 2003 19:57:13 -0000 1.19
+++ b/script.c 19 May 2004 04:44:42 -0000
@@ -206,21 +206,22 @@
void run_script(struct dhcpMessage *packet, const char *name)
{
int pid;
- char **envp;
+ char **envp, **curr;
if (client_config.script == NULL)
return;
DEBUG(LOG_INFO, "vforking and execle'ing %s", client_config.script);
+ envp = fill_envp(packet);
/* call script */
pid = vfork();
if (pid) {
waitpid(pid, NULL, 0);
+ for (curr = envp; *curr; curr++) free(*curr);
+ free(envp);
return;
} else if (pid == 0) {
- envp = fill_envp(packet);
-
/* close fd's? */
/* exec script */
--
Russ Dill <Russ.Dill at asu.edu>
More information about the busybox
mailing list