From owner-svn-src-head@freebsd.org Thu Sep 3 01:15:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A089C96BD; Thu, 3 Sep 2015 01:15:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1BACA2E; Thu, 3 Sep 2015 01:15:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t831FOeB037183; Thu, 3 Sep 2015 01:15:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t831FOmG037182; Thu, 3 Sep 2015 01:15:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509030115.t831FOmG037182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 3 Sep 2015 01:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287417 - head/usr.sbin/makefs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 01:15:24 -0000 Author: delphij Date: Thu Sep 3 01:15:23 2015 New Revision: 287417 URL: https://svnweb.freebsd.org/changeset/base/287417 Log: Don't leak 'var'. Reported by: clang static analyzer Modified: head/usr.sbin/makefs/mtree.c Modified: head/usr.sbin/makefs/mtree.c ============================================================================== --- head/usr.sbin/makefs/mtree.c Wed Sep 2 23:14:39 2015 (r287416) +++ head/usr.sbin/makefs/mtree.c Thu Sep 3 01:15:23 2015 (r287417) @@ -181,7 +181,7 @@ static char * mtree_resolve(const char *spec, int *istemp) { struct sbuf *sb; - char *res, *var; + char *res, *var = NULL; const char *base, *p, *v; size_t len; int c, error, quoted, subst; @@ -284,8 +284,10 @@ mtree_resolve(const char *spec, int *ist free(res); } free(var); + var = NULL; } + free(var); sbuf_finish(sb); res = (error == 0) ? strdup(sbuf_data(sb)) : NULL; sbuf_delete(sb);