diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2013-02-01 23:43:34 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2013-02-01 23:43:34 +0000 |
commit | b78b241c2b19eda80f131529b9942c299e634033 (patch) | |
tree | 5666821e551439b6218499cdc6c0c02d9a6bfb59 /sbin/dhclient | |
parent | 3844d4189b87e6ed351f926d19ec5b0317d509b1 (diff) |
do not leak dn if there is no resolv.conf contents; found by llvm
ok krw@
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 3a06afa7b2a..4ccb758abe0 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.221 2013/02/01 20:46:04 florian Exp $ */ +/* $OpenBSD: dhclient.c,v 1.222 2013/02/01 23:43:33 florian Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1967,8 +1967,10 @@ resolv_conf_contents(struct option_data *domainname, if (len > 0 && config->resolv_tail) len += strlen(config->resolv_tail); - if (len == 0) + if (len == 0) { + free(dn); return (NULL); + } len++; /* Need room for terminating NUL. */ contents = calloc(1, len); |