diff options
author | marcel <marcel@FreeBSD.org> | 2014-05-21 17:36:12 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2014-05-21 17:36:12 +0000 |
commit | 65627bf1cbe652f4e8bd9f5093dfd8e78fe4c3fb (patch) | |
tree | 5051a4a1df6f05823694918b8fa9d9363bb2948f /usr.bin/mkimg | |
parent | b00f7d7c651114b3fac6a1cf674ddf0004aa2f83 (diff) | |
download | FreeBSD-src-65627bf1cbe652f4e8bd9f5093dfd8e78fe4c3fb.zip FreeBSD-src-65627bf1cbe652f4e8bd9f5093dfd8e78fe4c3fb.tar.gz |
Fix CID 1215128: Free the allocated buf when image_set_size()
returns and error and we return from bsd_write().
Diffstat (limited to 'usr.bin/mkimg')
-rw-r--r-- | usr.bin/mkimg/bsd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/mkimg/bsd.c b/usr.bin/mkimg/bsd.c index 52c91f6..a93ed0d 100644 --- a/usr.bin/mkimg/bsd.c +++ b/usr.bin/mkimg/bsd.c @@ -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); |