Fix CID 1215128: Free the allocated buf when image_set_size()

returns and error and we return from bsd_write().
This commit is contained in:
Marcel Moolenaar 2014-05-21 17:36:12 +00:00
parent bce9a24a0e
commit 9746454f54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266510

View File

@ -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);