summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-03-02 16:39:00 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-03-02 16:39:00 +0000
commitbfdd1300ba3e56604f2366d4fd4f12e9c3cfe0db (patch)
treed6b6ec75622873ce892fd5a7132b29076bb08476
parentf32f33d8ea58cfc3c95893a51e64cf0d4ac4de1b (diff)
avoid memleak if parse_string() fails, Patrick Latifi <pat@eyeo.org>
-rw-r--r--usr.sbin/dhcp/common/parse.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/dhcp/common/parse.c b/usr.sbin/dhcp/common/parse.c
index 0d488f30d6e..90949a9ef16 100644
--- a/usr.sbin/dhcp/common/parse.c
+++ b/usr.sbin/dhcp/common/parse.c
@@ -119,13 +119,14 @@ char *parse_string (cfile)
skip_to_semi (cfile);
return (char *)0;
}
+ if (!parse_semi (cfile))
+ return (char *)0;
+
s = (char *)malloc (strlen (val) + 1);
if (!s)
error ("no memory for string %s.", val);
strlcpy (s, val, strlen(val) + 1);
- if (!parse_semi (cfile))
- return (char *)0;
return s;
}