summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcp
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-02-05 13:35:21 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-02-05 13:35:21 +0000
commitce9d675e6ed4b86fc4628a422b6bfd910adb2dec (patch)
tree51e109a2284e5c032f693b67394ba70039e540e5 /usr.sbin/dhcp
parent49c32ce0a422a8caf79ed35191dc2c93ee23ffb4 (diff)
plug memory leak; PR3668 Emil Mikulic <emikulic@dmr.ath.cx>
Diffstat (limited to 'usr.sbin/dhcp')
-rw-r--r--usr.sbin/dhcp/dhclient/dhclient.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/dhcp/dhclient/dhclient.c b/usr.sbin/dhcp/dhclient/dhclient.c
index 959bd444e00..bc69b24eae4 100644
--- a/usr.sbin/dhcp/dhclient/dhclient.c
+++ b/usr.sbin/dhcp/dhclient/dhclient.c
@@ -2028,8 +2028,9 @@ void script_init (ip, reason, medium)
{
if (ip) {
ip->client->scriptEnvsize = 100;
- ip->client->scriptEnv = malloc(ip->client->scriptEnvsize
- * sizeof(char *));
+ if (ip->client->scriptEnv == NULL)
+ ip->client->scriptEnv =
+ malloc(ip->client->scriptEnvsize * sizeof(char *));
if (ip->client->scriptEnv == NULL)
error ("script_init: no memory for environment initialization");