summaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorRuss Dill2004-05-19 07:45:47 +0000
committerRuss Dill2004-05-19 07:45:47 +0000
commit57f49d318552b093def4ecd2287d02b30f6d238b (patch)
tree2af6d3f9b12d914acbc76164b495105f2f54112c /networking/udhcp
parent21d7d61de164b25bc6a70e49b12567e80caed953 (diff)
downloadbusybox-57f49d318552b093def4ecd2287d02b30f6d238b.zip
busybox-57f49d318552b093def4ecd2287d02b30f6d238b.tar.gz
fix memory leak caused by switch to vfork
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/script.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index e0a8dad..820fbb0 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -206,21 +206,22 @@ static char **fill_envp(struct dhcpMessage *packet)
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 */