Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Oct 2015 11:38:48 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289687 - head/usr.sbin/makefs/cd9660
Message-ID:  <201510211138.t9LBcmQ8040029@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <scdbackup@gmx.net>
  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;
 }
 
 



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