From b78b241c2b19eda80f131529b9942c299e634033 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Fri, 1 Feb 2013 23:43:34 +0000 Subject: do not leak dn if there is no resolv.conf contents; found by llvm ok krw@ --- sbin/dhclient/dhclient.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sbin') 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 @@ -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); -- cgit v1.2.3