svn commit: r266510 - head/usr.bin/mkimg
Marcel Moolenaar
marcel at FreeBSD.org
Wed May 21 17:36:12 UTC 2014
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);
More information about the svn-src-all
mailing list