From owner-svn-src-all@freebsd.org Wed Oct 21 11:38:49 2015 Return-Path: Delivered-To: svn-src-all@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 5FAB9A1A99C; Wed, 21 Oct 2015 11:38:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2CD34F31; Wed, 21 Oct 2015 11:38:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9LBcmjS040030; Wed, 21 Oct 2015 11:38:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9LBcmQ8040029; Wed, 21 Oct 2015 11:38:48 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201510211138.t9LBcmQ8040029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 21 Oct 2015 11:38:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289687 - head/usr.sbin/makefs/cd9660 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2015 11:38:49 -0000 Author: ngie Date: Wed Oct 21 11:38:48 2015 New Revision: 289687 URL: https://svnweb.freebsd.org/changeset/base/289687 Log: Free buffer before returning from cd9660_write_path_table to avoid leaking it after returning from the function MFC after: 1 week PR: 203647 Submitted by: Thomas Schmitt Coverity CID: 978431 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/makefs/cd9660/cd9660_write.c Modified: head/usr.sbin/makefs/cd9660/cd9660_write.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_write.c Wed Oct 21 10:44:07 2015 (r289686) +++ head/usr.sbin/makefs/cd9660/cd9660_write.c Wed Oct 21 11:38:48 2015 (r289687) @@ -165,7 +165,7 @@ cd9660_write_path_table(FILE *fd, off_t diskStructure.pathTableLength); unsigned char *buffer; unsigned char *buffer_head; - int len; + int len, ret; path_table_entry temp_entry; cd9660node *ptcur; @@ -213,8 +213,10 @@ cd9660_write_path_table(FILE *fd, off_t ptcur = ptcur->ptnext; } - return cd9660_write_filedata(fd, sector, buffer_head, + ret = cd9660_write_filedata(fd, sector, buffer_head, path_table_sectors); + free(buffer); + return ret; }