Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2015 01:15:24 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287417 - head/usr.sbin/makefs
Message-ID:  <201509030115.t831FOmG037182@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509030115.t831FOmG037182>