diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-02 16:39:00 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-02 16:39:00 +0000 |
commit | bfdd1300ba3e56604f2366d4fd4f12e9c3cfe0db (patch) | |
tree | d6b6ec75622873ce892fd5a7132b29076bb08476 | |
parent | f32f33d8ea58cfc3c95893a51e64cf0d4ac4de1b (diff) |
avoid memleak if parse_string() fails, Patrick Latifi <pat@eyeo.org>
-rw-r--r-- | usr.sbin/dhcp/common/parse.c | 5 |
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; } |