From owner-svn-src-head@FreeBSD.ORG Wed May 21 17:36:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9FB6CBB0; Wed, 21 May 2014 17:36:12 +0000 (UTC) Received: from svn.freebsd.org (svn.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 8D5012D15; Wed, 21 May 2014 17:36:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4LHaCVi020975; Wed, 21 May 2014 17:36:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4LHaC5J020974; Wed, 21 May 2014 17:36:12 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201405211736.s4LHaC5J020974@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 21 May 2014 17:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266510 - head/usr.bin/mkimg 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.18 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: Wed, 21 May 2014 17:36:12 -0000 Author: marcel Date: Wed May 21 17:36:12 2014 New Revision: 266510 URL: http://svnweb.freebsd.org/changeset/base/266510 Log: Fix CID 1215128: Free the allocated buf when image_set_size() returns and error and we return from bsd_write(). Modified: head/usr.bin/mkimg/bsd.c Modified: head/usr.bin/mkimg/bsd.c ============================================================================== --- head/usr.bin/mkimg/bsd.c Wed May 21 17:34:50 2014 (r266509) +++ head/usr.bin/mkimg/bsd.c Wed May 21 17:36:12 2014 (r266510) @@ -82,8 +82,10 @@ bsd_write(lba_t imgsz, void *bootcode) imgsz = ncyls * nheads * nsecs; error = image_set_size(imgsz); - if (error) + if (error) { + free(buf); return (error); + } d = (void *)(buf + secsz); le32enc(&d->d_magic, DISKMAGIC);